This page is dedicated to MaxGUI, a GUI module for the programming language BlitzMax.
The source code can be found at this page
With the introduction of BlitzMax NG I had to create two different MaxGUI modules: there are some little differences between BlitzMax and BlitzMax NG under the hood, and at the moment the fastest solution is to have different packages.
MaxGUI module
MaxGUI - NG version
Installing instructions
- make a copy of your /mod/maxgui folder
- download the .zip file (see links above)
- extract the .zip file in C:\BlitzMax\mod (or whatelse)
- in MaxIDE, CTRL-D or ‘rebuild all modules’
- in MaxIDE ‘rebuild documentation’
In case of problems try the following solution:
- open the BlitzMax\mod\MaxGUI folder
- delete the .bmx folder
- delete all the files with suffix .i
- delete all the files tiwh suffix .a
- in MaxIDE press CTRL+D or ‘rebuild all modules’
- in MaxIDE ‘rebuild documentation’
In the current version I’ve added these features:
AutoAlignment
See commands SetGadgetAlignment.
You don’t need anymore to specify for each gadget position AND size (width or height). You can bypass these parameters and MaxGUI will handle them for you, using the ‘final’ command DoAlignment.
AddGadgetItems
AddGadgetItems(gadget:Tgadget,Object:Object,Select:int,_class:String)
This command allows 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.
The last parameter, _class, allows to choose what field of the type/class must be used. It’s based on Reflection system, so if a type ‘Auto’ has a field named ‘model’, you can pass – as parameter – ‘Auto.model’ to populate the gadget’s items with all the models of the auto Class.
SetGadgetFont
This is a little hack to change the applied font – with a single command – of ALL the gadgets in a container (window or panel).
Function SetGadgetFont( gadget:TGadget,font:TGuiFont )
gadget.SetFont( font )
If GadgetClass(gadget)=GADGET_WINDOW Or GadgetClass(gadget)=GADGET_PANEL
For Local gk:Tgadget=EachIn gadget.kids
if gk SetGadgetFont(gk,font)
Next
End If
End Function
GadgetDefault() & GadgetStyle()
I’ve added an ‘accelerator’ command: GadgetStyle()
Usually a group of gadget has the same graphic proprieties (like color, font, layout etc). So rathen than make the following
Global btn:tgadget[5]
For Local i:Int=0 To 4
btn[i]=CreateButton("Button #"+i,10,10+i*30,100,25,window)
SetGadgetColor btn [i],100,200,200,True
SetGadgetColor btn [i],200,0,200
Next
I implemented the logic to ‘select’ a default color (in this case) to apply to all the gadget created.
So the above code becomes
Global btn:tgadget[5]
SetGadgetDefault("FGCOLOR",[200,0,200])
SetGadgetDefault("BGCOLOR",[100,200,200])
For Local i:Int=0 To 4
btn[i]=CreateButton("Button #"+i,10,10+i*30,100,25,window)
Next
Basically I defined some ‘default style’ that can be used in MaxGUI. For each of them I can pass some parameters (via an INT array):
The supported proprieties are at the moment the following
- FGCOLOR (Foreground color) [red,green,blue]
- BGCOLOR (Background color)[red,green,blue]
- HIDDEN (true or false) [1,0]
- ENABLED (true or false)[1,0]
- LAYOUT [left,right,top,bottom] – see SetGadgetLayout() for the values.
GadgetDefault() allows to turn on/off a specific proprierty
The basic idea is to implement an easy way to change a ‘style’ of a gadget. The final goal could be to write the ‘style’ in a CSS style-like file…
OTHER LITTLE THINGS
Moreover I changed the MAXGUI source code adding the following constants for the proxygadgets (neither for the original ones – Splittler, Scroller and Hyperlink – there was a defined class).
GADGET_SPINNER
GADGET_CALENDAR
GADGET_CHECKLISTBOX
GADGET_DATEPICKER
GADGET_FILEPICKER
GADGET_ICONGADGET
GADGET_LISTMANAGER
GADGET_NOTIFY
GADGET_TABBERMANAGER
GADGET_USERINPUT
GADGET_HYPERLINK
GADGET_SCROLLPANEL
GADGET_SPLITTER
GADGET_BUTTONCHECKER
GADGET_COLORPICKER