Can't ResizeGadget to variable width?
Posted: Tue Dec 27, 2016 4:17 pm
I was just trying to see if I could resize a textgadget using a variable width, but I must be missing something here, because it's not working.
What am I not doing right?
What am I not doing right?
Code: Select all
Global Window_1
Global Text_0
Enumeration
#Font_0
EndEnumeration
LoadFont(#Font_0,"Arial", 40)
str$ = "TESTING"
strLength.i = Len(str$)
Procedure OpenWindow_1(x = 0, y = 0, width = 750, height = 260)
Window_1 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
Text_0 = TextGadget(#PB_Any, 110, 70, 50, 80, "")
SetGadgetText(Text_0, str$)
SetGadgetFont(Text_0, FontID(#Font_0))
ResizeGadget(Text_0, #PB_Ignore, #PB_Ignore, strLength*50, #PB_Ignore)
EndProcedure
Procedure Window_1_Events(event)
Select event
Case #PB_Event_CloseWindow
ProcedureReturn #False
Case #PB_Event_Menu
Select EventMenu()
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
ProcedureReturn #True
EndProcedure
OpenWindow_1()
Repeat
event = WaitWindowEvent()
Until Window_1_Events(event) = #False