releasemouse

Just starting out? Need help? Post your questions and find answers here.
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

releasemouse

Post by Skipsy »

Folks,

I am getting green with that f@#& windows events.

In a windowed screen i am using ExamineMouse() etc... I don't find a
way to say to the system that if the screen has no longer the focus
(masked by another app window), mouse control is back to the system
(releasemouse(1).

here is a summary of the code :

Code: Select all

While QUITTE = 0
  
  EVT_WIND.l = WindowEvent()
  Delay (1)

  If EventWindowID() = 1                                ; My window
    
      ReleaseMouse(0)
      ExamineMouse()

    Select EVT_WIND
      Case #PB_Event_CloseWindow
        QUITTE = 1
      Case blabla
    EndSelect
    
  Else
    ReleaseMouse(1)
  EndIf

Wend
I have also did a test using IsScreenActive but if I understood it is only
for full screen (?)

Any idea ?????
thks
Beware of the man who has the solution before he understands the problem...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: releasemouse

Post by PB »

Try this:

Code: Select all

If GetForegroundWindow_() <> WindowID()
  ; Your app no longer has the focus...
Else
  ; Your app has the focus!
EndIf
Franky
Enthusiast
Enthusiast
Posts: 213
Joined: Sat Apr 26, 2003 2:58 pm

Post by Franky »

Hi PB, perhaps get activewindow_() is better than get foregroundwindow_()

The DebuggerWindow for example is in the foreground even if it isn´t active
Give Up everything but trying!
Skipsy
User
User
Posts: 98
Joined: Wed Apr 30, 2003 12:26 pm
Location: France

Post by Skipsy »

Great !!!

Both work. I am turned back to my normal color :D

Many thks.
Beware of the man who has the solution before he understands the problem...
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Both work. I am turned back to my normal color
Are you sure? you still look a little green Image :D
--Kale

Image
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> perhaps get activewindow_() is better than get foregroundwindow_()

GetForegroundWindow_() is the API of the window that has the focus.
You can test this by running this simple app:

Code: Select all

; 3-second delay at start so you can give the
; focus to another app, to test the result.
;
Sleep_(3000)
Debug "Focus is: "+Str(GetForegroundWindow_())
Debug "Active is: "+Str(GetActiveWindow_())
Post Reply