Page 1 of 1
					
				opposite of #PB_Event_ActivateWindow?
				Posted: Thu Apr 14, 2011 9:16 pm
				by Brujah
				I get a window event when window comes back into focus.
How do I know that I lost the focus?
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Fri Apr 15, 2011 12:37 am
				by rsts
				-whoops, wrong platform.
cheers
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Fri Apr 15, 2011 7:47 am
				by Shardik
				Code: Select all
OpenWindow(0, 200, 100, 200, 180, "Focus test")
Repeat
  WindowEvent = WaitWindowEvent()
  Select WindowEvent
    Case #PB_Event_ActivateWindow
      Debug "Window received focus"
    Case #PB_Event_DeactivateWindow
      Debug "Window lost focus"
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Fri Apr 15, 2011 11:08 pm
				by nco2k
				
since when?! 
 
c ya,
nco2k
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Fri Apr 15, 2011 11:33 pm
				by rsts
				nco2k wrote:
since when?! 
 
c ya,
nco2k
 
I wondered the same thing. If not in 4.6 (which I'm not using yet), must be a lib.
cheers
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 10:11 am
				by eesau
				There is no #PB_Event_DeactivateWindow in 4.60.
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 12:35 pm
				by Shardik
				rsts wrote:nco2k wrote:
since when?! 
 
c ya,
nco2k
 
I wondered the same thing. If not in 4.6 (which I'm not using yet), must be a lib.
cheers
 
eesau wrote:There is no #PB_Event_DeactivateWindow in 4.60.
Did you at least try my code example? 
 
I tested it in andLinux/Kubuntu 9.04 with PB 4.51 after having observed that
receiving the focus generated an event 7 and loosing the focus event 8 in the
PB event loop. Then I opened the structure viewer and found that
#PB_Event_ActivateWindow = 7
#PB_Event_DeactivateWindow = 8
And my example runs like a charme in PB 4.41, 4.51 and 4.60 Beta 2... 

Click into the demo window (received focus is reported) and then click back
into the debugger window (lost focus is reported).
#PB_Event_DeactivateWindow is even displayed in the IDE's drop down list of
PB 4.41, 4.51 and 4.60 Beta 2...
Update: Works also like a charme in Xubuntu 10.04 LTS and PB 4.51.
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 1:40 pm
				by nco2k
				Shardik wrote:Did you at least try my code example?
i did.. thats why i was wondering. 
but since its an undocumented feature, its just experimental and can change any time. lets hope they make it available for all platforms soon though.
c ya,
nco2k
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 2:48 pm
				by eesau
				Shardik wrote:eesau wrote:There is no #PB_Event_DeactivateWindow in 4.60.
Did you at least try my code example? 
  
I did, but I only noticed this was for Linux! I tried with Windows version, and there is no such constant defined.
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 4:00 pm
				by TomS
				Doesn't work on Windows.
As eesau said, there's no such constant.
Replacing it with 8 doesn't do anything. No event.
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 4:45 pm
				by iostream
				TomS wrote:Doesn't work on Windows.
But under Windows you can use a callback.
 
			 
			
					
				Re: opposite of #PB_Event_ActivateWindow?
				Posted: Sat Apr 16, 2011 5:15 pm
				by Shardik
				eesau wrote:There is no #PB_Event_DeactivateWindow in 4.60.
eesau wrote:Shardik wrote:eesau wrote:There is no #PB_Event_DeactivateWindow in 4.60.
Did you at least try my code example? 
  
I did, but I only noticed this was for Linux! I tried with Windows version, and there is no such constant defined.
 
eesau,
in your first posting you didn't say anything about testing my code example
in Windows. Therefore your comment in this 
Linux subforum that there is no
#PB_Event_DeactivateWindow (without stating that you tested the Windows
version) was misleading and wrong...
@all,
I can confirm that #PB_Event_DeactivateWindow doesn't exist in the Mac version
neither. But for Linux users it should be OK to use that flag (although then the
code won't be cross-platform anymore). It would be nice if the PB devs would
make a statement whether this flag is planned to be implemented in the Windows
and Mac version and whether this flag may be used (it's displayed in the structure
viewer and the drop down list of the Linux version, so I consider it "documented")
or if it will be declared "deprecated" in future versions...