SetGadgetFont()

I’m still using BlitzMax+MaxGUI to create little applications in my daily work.
Recently I changed my monitor to a 22″ and the old apps I wrote seems very ‘small’ on the new monitor.

So I’m changing the window’s size of all the apps to ‘see’ them in a good manner.

I decided to put in the .ini file a GUI_SIZE parameter for the font used.
So I discovered that the command SetGadgetFont() works ONLY for a single gadget. At the time!

So I changed the MaxGUI source code, in maxgui.bmx

Rem
bbdoc: Set a gadget's font.
about: See #LoadGuiFont and #RequestFont for creating a @TGuiFont.
EndRem
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

Basically if the gadget parameter is a window or a panel they probably have gadget kids, and so I call recursevely the function to apply the new font. In one single call.
Handy.

The next step: find a way to setup a ‘default aspect ratio’ for a MaxGUI application.

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