MaxGUI variation

Just yesterday I posted about some ‘experiments’ I made with MaxGUI.

In particular ‘autoalignment’ was once thing I like to find native in MaxGUI. So I decided to re-do my own autoalignment version of MaxGUI and make it public.

You can find here the MaxGUI.mod (please make a copy of your version before install mine, build all modules and re-build documentation).

I’ve added 2 commands (auto-highlighted once you rebuild mods+docs)

SetGadgetAlignment (parent,alignment, size)

DoLayout()

the first one determines what type of alignment you want for the ‘next’ gadgets you will add: it can be MAXGUI_HORIZONTAL, or MAXGUI_VERTICAL

Size determines the distance from borders of the ‘gadgets’.

DoLayout() is needed to ‘make things happens’: without this command you cant’ see any gadgets at all! It does the ‘magic’ of placing the gadgets in the ‘parent’ selected.

By default the ‘reference parent’ is the latest windows created.

Every CreateGadget commands – now – has ‘default’ parameters: so you can ‘leave blank’ positions or sizes or parent; MaxGUI will try to determine automatically gadget’s dimensions.

This is an example of the default gadget paramets

 

SuperStrict
Import maxgui.drivers

Global window:tgadget=CreateWindow("Main",100,100,300,350,,WINDOW_CLIENTCOORDS|WINDOW_TITLEBAR|WINDOW_CENTER)
Global button:tgadget[5]

button[0]=		CreateButton("Hallo 1",,,,25)
button[1]=		CreateButton("Hallo 2",,30,,25)
button[2]=		CreateButton("Hallo 3",,60,,25)
button[3]=		CreateButton("Hallo 4",,90,,25)

Repeat
	WaitEvent()

	Select EventID()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select
Forever

This is an example of automatic layout

SuperStrict
Import maxgui.drivers

Global window:tgadget=CreateWindow("Main",100,100,300,350,,WINDOW_CLIENTCOORDS|WINDOW_TITLEBAR|WINDOW_CENTER)
Global button:tgadget[5]

SetGadgetAlignment(window,MAXGUI_VERTICAL,25)

button[0]=		CreateButton("Hallo 1")
button[1]=		CreateButton("Hallo 2")
button[2]=		CreateButton("Hallo 3")
button[3]=		CreateButton("Hallo 4")

DoAlignment()

Repeat
	WaitEvent()

	Select EventID()
		Case EVENT_APPTERMINATE, EVENT_WINDOWCLOSE
			End
	End Select
Forever

Except CreatePanel command and proxygadgets , every other CreateGadget command has been rewritten to play with Autoalignment feature. I’ve tested it on Windows XP and with FLTK (win32).

Of course consider this MaxGUI variation like an experiment: I can’t guarantee it’s bugfree! It’s is just a proof of concept, and – for sure – I will try to change the autoalignment features in the future.

 

Another variation I’ve added is AddGadgetItems(gadget,object,select)

This command allow to add – in a faster way – several items to a gadget that support items (like gadgetbox or listbox)

The parameter object can be a string array, a list or a map (in this case only MapKeys are considered).

The select parameter indicates what item must be ‘selected’ in the gadget list.

 

Cheers

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close