Window 1 is clear, but now window 8, window 11 needs also the mouse, for drawing.
Johannes
Using an EventHandler on a Gadget
Re: Using an EventHandler on a Gadget
Window 8:
A roundtine to get the height and manipulate them, is smaller then the others windows.
When I fill in the second routine, container gadget
InstallEventHandler_(GetWindowEventTarget_(WindowID(8)), EventHandlerUPP, Events_Count, @eventTypes(), @CallBackEventsHandler(), @handlerref)
InstallEventHandler_(GetControlEventTarget_(GadgetID(#Container2)), EventHandlerUPP, Events_Count, @eventTypes(), @CallBackEventsHandler(), @handlerref)
it hangs up.
Johannes
A roundtine to get the height and manipulate them, is smaller then the others windows.
When I fill in the second routine, container gadget
InstallEventHandler_(GetWindowEventTarget_(WindowID(8)), EventHandlerUPP, Events_Count, @eventTypes(), @CallBackEventsHandler(), @handlerref)
InstallEventHandler_(GetControlEventTarget_(GadgetID(#Container2)), EventHandlerUPP, Events_Count, @eventTypes(), @CallBackEventsHandler(), @handlerref)
it hangs up.
Johannes
Re: Using an EventHandler on a Gadget
Was it not clear enough?
Johannes
Johannes
Re: Using an EventHandler on a Gadget
Is solved
Johannes
Johannes
Re:
not work in cocoaNiffo wrote: ↑Thu May 07, 2009 6:25 pm A solution :
Code: Select all
#kEventClassMouse = 'mous' #kEventClassControl = 'cntl' #kEventMouseDown = 1 #kEventMouseUp = 2 #kEventMouseMoved = 5 #kEventMouseDragged = 6 #kEventControlTrackingAreaEntered = 23 #kEventControlTrackingAreaExited = 24 ImportC "/System/Library/Frameworks/Carbon.framework/Carbon" GetEventClass.i(inEvent.l) HIViewNewTrackingArea(inView.l, inShape.l, inID.q, *outRef) EndImport Structure EventTypeSpec eventClass.l eventKind.l EndStructure OpenWindow(0, 100,100, 300, 200, "Test Window") ContainerGadget(0, 100, 100, 50, 50, #PB_Container_Single) ProcedureCDLL CallBackEventsHandler(*nextHandler, theEvent, *CallBackProc) Static OnTheControl.b Select GetEventClass(theEvent) Case #kEventClassMouse If OnTheControl Select GetEventKind_(theEvent) Case #kEventMouseDown Debug "MouseDown" Case #kEventMouseMoved, #kEventMouseDragged Debug "MouseMove" Case #kEventMouseUp Debug "MouseUp" EndSelect EndIf Case #kEventClassControl ;{ Select GetEventKind_(theEvent) Case #kEventControlTrackingAreaEntered OnTheControl = #True Case #kEventControlTrackingAreaExited OnTheControl = #False EndSelect EndSelect If *nexthandler : CallNextEventHandler_(*nextHandler, theEvent) : EndIf EndProcedure ; Window handler EventHandlerUPP = NewEventHandlerUPP_(@CallBackEventsHandler()) Events_Count = 4 Dim eventTypes.EventTypeSpec(Events_Count - 1) eventTypes(0)\eventClass = #kEventClassMouse eventtypes(0)\eventKind = #kEventMouseDown eventTypes(1)\eventClass = #kEventClassMouse eventtypes(1)\eventKind = #kEventMouseMoved eventTypes(2)\eventClass = #kEventClassMouse eventtypes(2)\eventKind = #kEventMouseDragged eventTypes(3)\eventClass = #kEventClassMouse eventtypes(3)\eventKind = #kEventMouseUp InstallEventHandler_(GetWindowEventTarget_(WindowID(0)), EventHandlerUPP, Events_Count, @eventtypes(), @CallBackEventsHandler(), @handlerref) ; Gadget hanlder EventHandlerUPP = NewEventHandlerUPP_(@CallBackEventsHandler()) Events_Count = 2 Dim eventTypes.EventTypeSpec(Events_Count - 1) eventTypes(0)\eventClass = #kEventClassControl eventtypes(0)\eventKind = #kEventControlTrackingAreaEntered eventTypes(1)\eventClass = #kEventClassControl eventtypes(1)\eventKind = #kEventControlTrackingAreaExited HIViewNewTrackingArea(GadgetID(0), #Null, 0, #Null) InstallEventHandler_(GetControlEventTarget_(GadgetID(0)), EventHandlerUPP, Events_Count, @eventtypes(), @CallBackEventsHandler(), @handlerref) Repeat Select WaitWindowEvent() Case #PB_Event_CloseWindow Break EndSelect ForEver