Is Splitter not event hook friendly?

BlitzMax Forums/MaxGUI Module/Is Splitter not event hook friendly?

MikeHart(Posted 2012) [#1]
Hi folks,

if I do the WAITEVENT handling inside a regular loop, then the splitter is acting normal. If I put all the event handling inside a event hook function like is shown inside the documentation, then the splitter doesn't move/react at all. Any ideas?

I have just normal gadgets in my app. Menu, toolbar, tab control, listbox.


jsp(Posted 2012) [#2]
Beside the slow redraw of gadgets on top during moving the splitter or resize, it's working as expected and I don't have any problems with it.
Some code?


Zeke(Posted 2012) [#3]
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


MikeHart(Posted 2012) [#4]
Mmmh, thanks. I will study this to see where the difference is.


MikeHart(Posted 2012) [#5]
@Zeke, thanks a lot. I didn't return the object from the hook function. That was it!!!