KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Timer forces Form Activate

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Sat Jun 23, 2007 12:02 am    Post subject: Timer forces Form Activate Reply with quote

I've added a Timer control to my application. Whenever the Timer event is started, it triggers a Form Activate (or something like that) so when the Form is minimized or not in focus, it flashes in the taskbar.

Any idea what's causing this? Is this expected behavior?

I even left the .Tick function blank and it still steals focus.

Code:

   $tmrCQS = $System.Timer()
   $tmrCQS.Interval = 10000
   $tmrCQS.Tick = 'tmrCQSTick()'

Function tmrCQSTick()
   
EndFunction

Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Sat Jun 23, 2007 12:20 am    Post subject: Reply with quote

If you start the code below and minimize do you see this behavior ? Every 3 seconds the number in the Form title bar is incremented by one. Should be able to see the "count" from the taskbar. Does it flash ?

What OS btw ?

Code:

Break On

$System = CreateObject("Kixforms.System")

$Form = $System.Form()
$Form.Text = 0

$Timer1 = $System.Timer()
$Timer1.Interval = 3000
$Timer1.Tick = "Timer1_Tick()"

$Form.Center
$Form.Show
$Timer1.Start

While $Form.Visible
   $=Execute($System.DoEvents)
Loop

Exit 0

Function Timer1_Tick()
 $Form.Text = Val($Form.Text)+1
EndFunction

Back to top
View user's profile Send private message
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Sat Jun 23, 2007 6:19 pm    Post subject: Reply with quote

There is an OS preference to not let apps steal focus.
_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Mon Jun 25, 2007 7:58 pm    Post subject: Reply with quote

Shawn, your code doesn't steal focus, so it has to be my application. I don't understand; I even added a checkbox to your code which drives the timer's start/stop. I even commented out portions of my code that will only start/stop the timer when the checkbox is checked/unchecked respectively. It likes to steal focus at timer interval.

I'm running XP Pro SP2. I'll investigate more to see what's going on.

Thanks!


Last edited by pearly on Mon Jun 25, 2007 11:45 pm; edited 1 time in total
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jun 25, 2007 8:56 pm    Post subject: Reply with quote

k no problem - keep chopping until you nail it.
Back to top
View user's profile Send private message
pearly
KiXforms Aficionado
KiXforms Aficionado


Joined: 27 Jan 2004
Posts: 332

PostPosted: Tue Jun 26, 2007 12:10 am    Post subject: Reply with quote

Arggghh...I found the problem. Every time the application executed an event, it would enable the parent form and activate it. The Activate method placed focus on the app every 10 seconds from the Timer control.

Code:

$frmMain.Show
While $frmMain.Visible
   If $frmAddServer.Visible
      If Not ($frmMain.Enabled = $FALSE)
         $frmMain.Enabled = $FALSE
      EndIf
      $frmAddServer.Activate
   Else
      $frmMain.Enabled = $TRUE
      $frmMain.Activate
   EndIf
   $=Execute($System.Application.DoEvents)
Loop


So I have carefully placed $frmMain.Activate to child form closing event and it solved the problem. Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group