New topic: 

window focus question

<http://forums.realsoftware.com/viewtopic.php?t=30535>

       Page 1 of 1
   [ 5 posts ]                 Previous topic | Next topic         Author  
Message       ikkyino           Post subject: window focus questionPosted: Sat 
Oct 17, 2009 10:35 pm                        
Joined: Sun Nov 02, 2008 7:39 pm
Posts: 12              Hi, I was wondering if there is anything like 
window.gotfocus?

Like on MSN for example, when the window is selected it won't flash/bounce in 
the taskbar/dock

i want something like... but it obviously doesn't exist 
if window1.gotfocus then

I can't find anything that exists to do this..  And if there isn't anything.. 
How would I go about creating something to do this for me?

-Ikky   
                            Top                Steve Garman           Post 
subject: Re: window focus questionPosted: Sun Oct 18, 2009 1:25 am              
                 
Joined: Fri Sep 30, 2005 3:53 pm
Posts: 3053
Location: England              Are you looking for the Window.Activate Event?   
  
_________________
Steve Garman
Using REALbasic 2008r2 Professional on Windows Vista Ultimate
and REALbasic 2009r4 Professional on Linux Ubuntu 9.04 Desktop
Occasional blog  
                            Top               Phil M           Post subject: 
Re: window focus questionPosted: Sun Oct 18, 2009 1:27 am                       
 
Joined: Fri Sep 30, 2005 12:18 pm
Posts: 140              The bouncing dock thing is a little confusing... the 
dock icon IS bouncing and you want it to stop, or you want to add the bounce 
until the window is activated?

Its interesting, but a brief look at the Language Reference doesn't show me any 
way to make a window move to the front.  Although its possible that the Show 
command might have that side-effect even if visible, and if not visible, you 
could probably Hide and Show it again to move it to the front (within your 
application space at least).  Or do you want to move the window in front of ALL 
windows open on the computer?   
                            Top               ikkyino           Post subject: 
Re: window focus questionPosted: Sun Oct 18, 2009 1:30 am                       
 
Joined: Sun Nov 02, 2008 7:39 pm
Posts: 12              Quote:Are you looking for the Window.Activate Event?

Edit: Actually... this didn't work the way I wanted it to  Even though it seems 
like it should in the language refrence.. I think I need to mess around with it 
a little
Quote:The bouncing dock thing is a little confusing... the dock icon IS 
bouncing and you want it to stop, or you want to add the bounce until the 
window is activated?

Its interesting, but a brief look at the Language Reference doesn't show me any 
way to make a window move to the front. Although its possible that the Show 
command might have that side-effect even if visible, and if not visible, you 
could probably Hide and Show it again to move it to the front (within your 
application space at least). Or do you want to move the window in front of ALL 
windows open on the computer?

No, I just needed to know if the current window had the 'focus' or not... I'm 
just usig MSN as an example because it resembles of what I need done... IF 
something changes i have the window flash, but I don't want it to flash if the 
window is already open and has the 'focus'   
                            Top                Phil M           Post subject: 
Re: window focus questionPosted: Sun Oct 18, 2009 1:59 am                       
 
Joined: Fri Sep 30, 2005 12:18 pm
Posts: 140              Ah, yes the Activate event within the is what you are 
looking for.  The Deactivate event means your window is no longer the focus, 
but you don't know if the new window focus is another app or another window in 
your application.

You can "register" the active window by calling a global method.
Code:Sub HeyIAmActiveNow( w As Window )
  // property defined somewhere as activeWindow As Window or a specific type of 
window
  activeWindow = w
End Sub

Sub OhManIFeelShunned( w As Window )
  // property defined somewhere as activeWindow As Window or a specific type of 
window
  If ( activeWindow = w ) Then activeWindow = Nil
End Sub

// In your window Activate event
HeyIAmActiveNow( Me )

// In your window Deactivate event
OhManIFeelShunned( Me )


Then you can just peak at "activeWindow" if its not Nil to find out which one 
is the active window.   
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 5 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to