Page 1 of 1

Posted: Tue Jan 22, 2002 9:08 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

What's a good place for checking mouse events in the WaitWindowEvent loop and what type of mouse command can be used?

WaitWindowEvent loop

Repeat

Select WaitWindowEvent()

Case #PB_EventMenu

Case #PB_EventRepaint

Case #WM_CLOSE ; #PB_EventCloseWindow
Quit = 1

EndSelect

Until Quit = 1

EndIf

End



Registered user of PB

C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Wed Jan 23, 2002 1:03 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

In your sample, I would put it after the rest of the event check, because some of those imply mouse events.

Bye,

El_Choni

Posted: Wed Jan 23, 2002 9:31 am
by BackupUser
Restored from previous forum. Originally posted by Manolo.
What's a good place for checking mouse events in the WaitWindowEvent loop and what type of mouse command can be used?
This is the best position:

Code: Select all

TextGadget  (12, 10, #WindowHeight-50, 250, 24, "PureBasic - Gadget demonstration")

Repeat 
  EventID.l = WaitWindowEvent()
   
 SetGadgetText(12, "x: "+Str(WindowMouseX())+", y: "+Str(WindowMouseY()))
    
    If EventID = #WM_KEYUP Or EventID = #WM_KEYDOWN
      SetGadgetText(12, "Key: "+Str(EventwParam()))
    EndIf
   If EventID = #PB_EventGadget
   Select EventGadgetID()
Regards,
Manolo
[url]mailto:vpardo@infonegocio.com[/url]