opposite of #PB_Event_ActivateWindow?

Linux specific forum
User avatar
Brujah
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Nov 03, 2003 7:45 pm
Location: Germany
Contact:

opposite of #PB_Event_ActivateWindow?

Post by Brujah »

I get a window event when window comes back into focus.
How do I know that I lost the focus?
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: opposite of #PB_Event_ActivateWindow?

Post by rsts »

-whoops, wrong platform.

cheers
Last edited by rsts on Fri Apr 15, 2011 8:54 am, edited 1 time in total.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: opposite of #PB_Event_ActivateWindow?

Post 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
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: opposite of #PB_Event_ActivateWindow?

Post by nco2k »

Code: Select all

#PB_Event_DeactivateWindow
since when?! :shock:

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Re: opposite of #PB_Event_ActivateWindow?

Post by rsts »

nco2k wrote:

Code: Select all

#PB_Event_DeactivateWindow
since when?! :shock:

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
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: opposite of #PB_Event_ActivateWindow?

Post by eesau »

There is no #PB_Event_DeactivateWindow in 4.60.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: opposite of #PB_Event_ActivateWindow?

Post by Shardik »

rsts wrote:
nco2k wrote:

Code: Select all

#PB_Event_DeactivateWindow
since when?! :shock:

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... :wink:
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.
Last edited by Shardik on Sat Apr 16, 2011 2:11 pm, edited 1 time in total.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: opposite of #PB_Event_ActivateWindow?

Post 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
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: opposite of #PB_Event_ActivateWindow?

Post 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.
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: opposite of #PB_Event_ActivateWindow?

Post 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.
iostream
User
User
Posts: 12
Joined: Thu Jul 31, 2008 12:36 pm
Location: Germany

Re: opposite of #PB_Event_ActivateWindow?

Post by iostream »

TomS wrote:Doesn't work on Windows.
But under Windows you can use a callback.
PB 4.51 with Windows 7 Professional & Linux Mint Julia
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: opposite of #PB_Event_ActivateWindow?

Post 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...
Post Reply