Actually I just use the same flags for the text gadget and that works.
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Button_0
#Text_3
#String_INPUT
#Text_2
#Text_1
#Text_0
#String_2
#String_1
#String_0
EndEnumeration
Structure VisualDesignerGadgets
Gadget.l
EventFunction.l
EndStructure
Global NewList EventProcedures.VisualDesignerGadgets()
Procedure Button_0_Event(Window, Event, Gadget, Type)
Debug "#Button_0"
what$ = GetGadgetText(#String_INPUT)
For x = #String_2 To #String_0
SetGadgetText(x, what$)
Next
EndProcedure
Procedure String_INPUT_Event(Window, Event, Gadget, Type)
Debug "#String_INPUT"
EndProcedure
Procedure String_2_Event(Window, Event, Gadget, Type)
Debug "#String_2"
EndProcedure
Procedure String_1_Event(Window, Event, Gadget, Type)
Debug "#String_1"
EndProcedure
Procedure String_0_Event(Window, Event, Gadget, Type)
Debug "#String_0"
EndProcedure
Procedure RegisterGadgetEvent(Gadget, *Function)
If IsGadget(Gadget)
AddElement(EventProcedures())
EventProcedures()\Gadget = Gadget
EventProcedures()\EventFunction = *Function
EndIf
EndProcedure
Procedure CallEventFunction(Window, Event, Gadget, Type)
ForEach EventProcedures()
If EventProcedures()\Gadget = Gadget
CallFunctionFast(EventProcedures()\EventFunction, Window, Event, Gadget, Type)
LastElement(EventProcedures())
EndIf
Next
EndProcedure
Procedure Open_Window_0()
If OpenWindow(#Window_0, 5, 5, 404, 145, "TEXT STUFF", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 5, 10, 120, 20, "left")
RegisterGadgetEvent(#String_0, @String_0_Event())
StringGadget(#String_1, 140, 10, 120, 20, "center", #PB_Text_Center)
RegisterGadgetEvent(#String_1, @String_1_Event())
StringGadget(#String_2, 275, 10, 120, 20, "right", #PB_Text_Right)
RegisterGadgetEvent(#String_2, @String_2_Event())
TextGadget(#Text_0, 5, 35, 120, 20, "LEFT")
TextGadget(#Text_1, 140, 35, 120, 20, "CENTER", #PB_Text_Center)
TextGadget(#Text_2, 275, 30, 120, 20, "RIGHT", #PB_Text_Right)
StringGadget(#String_INPUT, 5, 60, 390, 20, "") ; input box
RegisterGadgetEvent(#String_INPUT, @String_INPUT_Event())
TextGadget(#Text_3, 5, 85, 390, 15, "TYPE A WORD AND HIT THE BUTTON", #PB_Text_Center)
ButtonGadget(#Button_0, 5, 105, 390, 30, "ENTER THE TEXT")
RegisterGadgetEvent(#Button_0, @Button_0_Event())
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
Gadget = EventGadget()
Type = EventType()
Window = EventWindow()
Select Event
Case #PB_Event_Gadget
CallEventFunction(Window, Event, Gadget, Type)
EndSelect
Until Event = #PB_Event_CloseWindow
End