Page 1 of 1

Mouse problem

Posted: Thu Aug 05, 2004 5:53 pm
by alanuk
The code below doesn't work between the hash lines. I have checked the help files and I think I am doing it the way it says, but obviously I am missing something.

Can anybody help please?

Thanks

Alan



If Window_Form1()
quitForm1=0
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
If EventWindowID()=#Window_Form1
quitForm1=1
EndIf

Case #PB_Event_Gadget
Select EventGadgetID()
Case #Gadget_Form1_TrackBar3
etc etc etc
EndSelect
EndSelect
#####################################################
event=EventType()
Select event
Case #PB_EventType_LeftClick
Debug "found"
; draw
If StartDrawing(WindowOutput())
If InitMouse()
Plot(WindowMouseX(),WindowMouseY(),RGB(255,0,0))
StopDrawing()
EndIf
EndIf
EndSelect
######################################################

Until quitForm1=1
CloseWindow(#Window_Form1)
EndIf
End

Posted: Thu Aug 05, 2004 6:01 pm
by GreenGiant
Dont know about the rest of your code, its hard to check without the full lot, but you dont need the InitMouse() for WindowMouseX(). The InitMouse() set of commands is normally used for games and not apps, and even then InitMouse() only needs to be called once at the start of the code.

Posted: Fri Aug 06, 2004 7:15 am
by alanuk
GreenGiant, no, it's not that, it's the fact that it doesn't get into this section. There is something wrong with the event statement, but I can't see what it is.

Alan

Posted: Fri Aug 06, 2004 8:15 am
by plouf
Eventtype() returns event happened in gadget only and not in window
(mouse click in blank window area)
at least retunr event here :wink:
if you use
EventID=#WM_LBUTTONDOWN
you can get left mouse button in window note EventID from waitwindowevent

Posted: Fri Aug 06, 2004 11:53 am
by Nico

Code: Select all

If Window_Form1() 
  quitForm1=0 
  Repeat 
    EventID=WaitWindowEvent() 
    Select EventID 
      Case #PB_Event_CloseWindow 
        If EventWindowID()=#Window_Form1 
          quitForm1=1 
        EndIf 
        
      Case #PB_Event_Gadget 
        Select EventGadgetID() 
          Case #Gadget_Form1_TrackBar3 
            etc etc etc 
        EndSelect   
    ##################################################### 
      Case #WM_LBUTTONDOWN 
        Debug "found" 
        ; draw 
        If StartDrawing(WindowOutput()) 
          If InitMouse() 
            Plot(WindowMouseX(),WindowMouseY(),RGB(255,0,0)) 
            StopDrawing() 
          EndIf 
        EndIf 
        ###################################################### 
    EndSelect  
  Until quitForm1=1 
  CloseWindow(#Window_Form1) 
EndIf 
End

Posted: Sat Aug 07, 2004 11:22 am
by alanuk
Thanks guys, problem now solved. #WM_LBUTTONUP/DOWN did the job.

Alan