

But the last few tries didn't goes well. Any help?
Code: Select all
OpenWindow(0,1,1,310,90,"Test", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
StringGadget(0,5,50,300,24,"Test")
ButtonGadget(1,276,0,20,20,">")
SetParent_(GadgetID(1), GadgetID(0)) ; <===== simple, but with redrawing problems
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
hWnd = OpenWindow(0,#PB_Ignore,#PB_Ignore,250,50,"leer",#WS_OVERLAPPEDWINDOW)
StringGadget(0,10,10,200,22,"",#WS_CLIPSIBLINGS)
ButtonGadget(1,210-22,12,20,19,"...")
SetWindowPos_(GadgetID(0),#HWND_BOTTOM,0,0,0,0,#SWP_NOMOVE|#SWP_NOSIZE)
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Code: Select all
Enumeration
#Window_0
EndEnumeration
Enumeration
#Text_0
#Button_0
#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"
Goober$ = GetGadgetText(#String_0)
SetGadgetText(#Text_0, Goober$)
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, 400, 112, "Window 0", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
;If CreateGadgetList(WindowID(#Window_0))
StringGadget(#String_0, 10, 15, 340, 30, "")
ButtonGadget(#Button_0, 350, 15, 35, 30, ">>")
RegisterGadgetEvent(#Button_0, @Button_0_Event())
TextGadget(#Text_0, 10, 60, 375, 30, "", #PB_Text_Center | #PB_Text_Border)
; 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