glade -> maxgui -> event callbacks

BlitzMax Forums/MaxGUI Module/glade -> maxgui -> event callbacks

Chris C(Posted 2006) [#1]
Heres the prize!
example.bmx
Import "loadglade.bmx"

LoadGlade("test1\test1.glade")

Global edit1:guiwrap=findGadget("entry1")
Global label1:guiwrap=findGadget("label1")
Global button1:guiwrap=findGadget("button1")

Global mainwindow:guiwrap=findGadget("window1")

' you can share callback functions ie button2.setActionCallBack(quitme)
mainwindow.setCloseCallBack(quitme)
edit1.setActionCallBack(edit1action)
button1.setActionCallBack(button1action)

processGUI()

Function quitme()		;	End		;	End Function

Function edit1action()	;	SetGadgetText(label1.maxgad,GadgetText(edit1.maxgad))	;	End Function

Function button1action()
	SetGadgetText(edit1.maxgad,"")
	SetGadgetText(label1.maxgad,"")
End Function

Dunno about you but I'm tired of long winded event select clauses... Delphi introduced me to event callback ages ago and its a powerful idea.

For the time being I'm using a couple of Tmap's to convert pointers but I could get round the need for both if only all BRL objects had a UserData:Object field...

andhow its a bit hackerish cause I tried out a bunch of different ideas.

Idealy it would need a more specific editor (but glade will fill the gap for a fair while!) it only has callbacks for 2 event types three gui object types and the minimum of gadget properties.

That said even with such a limited implementation it shows the convienience of this approch in terms of rapid application development.

I'd really welcome peoples feedback on this as I think that a community user interface system like this would greatly speed up gui development


loadglade.bmx


test1.glade (load and visually edit widgets with glade)


if the callback functions were in gui editor properties then the whole code could be automatically created...


Blueapples(Posted 2008) [#2]
This is awesome. Has anyone expanded on this stuff at all? Using glade to build interfaces would be much better than the terrible hack fest of tweak creation code / build, run / repeat.