Function hook:Object(id:Int,data:Object,context:Object)
'your event handling code here
'...
Return data 'add this
End Function
example:
Strict
Import MaxGUI.Drivers
Import MaxGUI.ProxyGadgets
Global wndMain:TGadget = CreateWindow("Splitter Example",100,100,400,300,Null,WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_CENTER|WINDOW_CLIENTCOORDS|WINDOW_STATUS)
'Create a splitter gadget
Global spltMain:TSplitter = CreateSplitter( 0, 0, ClientWidth(wndMain), ClientHeight(wndMain), wndMain )
SetGadgetLayout spltMain,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED
Local tmpSplitPanel:TGadget
'Add a gadget to our left pane
tmpSplitPanel = SplitterPanel(spltMain,SPLITPANEL_MAIN)
Global txtEditor:TGadget = CreateTextArea(0,0,ClientWidth(tmpSplitPanel),ClientHeight(tmpSplitPanel),tmpSplitPanel,TEXTAREA_WORDWRAP)
SetGadgetLayout(txtEditor,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED)
AddTextAreaText(txtEditor, "The quick brown fox jumped over the lazy dogs.~n~n")
AddTextAreaText(txtEditor, "The quick brown fox jumped over the lazy dogs.~n~n")
AddTextAreaText(txtEditor, "The quick brown fox jumped over the lazy dogs.~n~n")
'Add a gadget to our right pane
tmpSplitPanel = SplitterPanel(spltMain,SPLITPANEL_SIDEPANE)
Global treeView:TGadget = CreateTreeView(0,0,ClientWidth(tmpSplitPanel),ClientHeight(tmpSplitPanel),tmpSplitPanel)
SetGadgetLayout(treeView,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED,EDGE_ALIGNED)
AddTreeViewNode("Child", AddTreeViewNode("Parent Node", TreeViewRoot(treeView)))
AddTreeViewNode("Other", TreeViewRoot(treeView))
AddHook(EmitEventHook,hook)
Repeat
WaitEvent()
Forever
Function hook:Object(id:Int,data:Object,context:Object)
Local event:TEvent=TEvent(data)
Select event.id
Case event_windowclose,event_appterminate;End
Case event_gadgetaction
AddTextAreaText(txteditor,"!")
Return Null
End Select
Return data 'comment this line and try to move splitter
End Function
Last edited 2012
|