hook mouse

BlitzMax Forums/BlitzMax Beginners Area/hook mouse

Smokey(Posted 2005) [#1]
Hi

I have made a hook
Strict

Function MyEventHook:Object( id,data:Object,context:Object )

	Local ev:TEvent=TEvent(data)
	
      Select ev.id
            Case EVENT_WINDOWCLOSE
                Print "yess work"
                End
'POP UP
            Case Event_Mousedown 
                 Select ev.data
                       Case Mouse_Right
                            End
                 End Select
      End Select
End Function

AddHook EmitEventHook,MyEventHook

Local window:TGadget

window=CreateWindow( "A window!",0,0,640,480 )
While True
	WaitEvent
	
Wend


my code is not working ....why I can't get the input of my mouse?


Eric(Posted 2005) [#2]
I believe you need a Canvas

Strict
Function MyEventHook:Object( id,data:Object,context:Object )

Local ev:TEvent=TEvent(data)

Select ev.id
Case EVENT_WINDOWCLOSE
Print "yess work"
End
'POP UP
Case Event_Mousedown
Select ev.data
Case Mouse_Right
End
End Select
End Select
Return Data
End Function

AddHook EmitEventHook,MyEventHook

Local window:TGadget

window=CreateWindow( "A window!",0,0,640,480 )
Global Canvas:Tgadget=CreateCanvas(0,0,640,480,Window)

While True
WaitEvent

Wend

Also you are supposed to return the data:Object.

Hope this helps because I don't understand hooks myself


Smokey(Posted 2005) [#3]
humm ..thanks Eric :) well a Canvas provides a Graphics interface for realtime drawing purposes the mouse hooks should also work with window ether, I starting to understand hooks but It's won't work with mouse. I really hope there will some doc about all this.