Page 1 of 1

Resizing Gui text.

Posted: 09 May 2020, 20:02
by PuzzledGreatly
I am trying to resize a text control so that it can accommodate a change of font and a change of content. Things aren't going very well. Here is my function for finding the size of the new text area:

Code: Select all

	Global NH, TH, TY
	static h, hh
	Gui, set:new, -dpiscale -caption
	Gui, set:margin, 0,0
	Gui, set:font, s%f%
	Gui, set:add, text, w%w% vh, %t%
	Guicontrolget, h, set:pos
	Gui, set:show, autosize
	msgbox, 4096, screen: %NH%, h: %hh%
	Gui, set:destroy
	TY := floor((NH - hh)/2)
	TH := hh
And here is the code to display the result:

Code: Select all


	FF := SetFont(quest,TW,NH)
	Gui, Game:font, s%FF%
	Guicontrol, Game:font, B
	Guicontrol, Game:, B, %quest%
	GuiControl, Game:movedraw, B, y%TY% h%TH%
	Guicontrol, Game:show, B
	msgbox, 4096, screen: %NH%, h: %th%
The two screenshots below show the result. For some reason the resized text is cut off at the bottom. The Gui that the text is resized on has -dpiscale set. Why is the text not displaying correctly? Thanks.
SetTexPos.png (53 KiB) Viewed 174 times
Display.png (47.4 KiB) Viewed 174 times

Re: Resizing Gui text.

Posted: 09 May 2020, 20:08
by PuzzledGreatly
As soon as I posted this I saw my error. I' didn't specify the font to be used in SetTextPos. Once I did that the Display text displayed correctly.