samfisherirl/GuiResizer-Addons

Change of font-size crashes the GUI buttons

Cyberklabauter opened this issue · 3 comments

I have another problem with the GUI. When I change the font size there is an error because of the buttons that do not have text (there are drawn as images).

MyGui.SetFont("s11 bold", "MS Sans Serif")

The only workaround found is to add a text element after the buttons. Or is there a way to fix this?

I don't know if this error is more related to the CreateImageButton lib?

The solution is to set the font individually for each control instead of setting it globally. Replace

MyGui.SetFont("s11 bold", "MS Sans Serif")`

with

myCtrls.RadioButton1.SetFont("s11 bold", "MS Sans Serif")`.

for each control.

This takes some effort, but works well.

The solution is to set the font individually for each control instead of setting it globally. Replace

MyGui.SetFont("s11 bold", "MS Sans Serif")`

with

myCtrls.RadioButton1.SetFont("s11 bold", "MS Sans Serif")`.

for each control.

This takes some effort, but works well.

	fontArray := []
	fontArray.Push(ButtonOK := myGui.Add("Button", "x247 y51 w80 h24", "&OK"))
	fontArray.Push(ButtonOK2 := myGui.Add("Button", "x240 y125 w76 h30", "&OK"))
	
	for btn in fontArray
		btn.SetFont("s21")

Nice! Thank you for the hint!