Restored from previous forum. Originally posted by ricardo.
Im really pleased with PureBasic, im learning and finding easy ways to do what are much difficult in other languages.
In my IRC Client i was wondering how to do a multiwindows app and how to control it and even how to create windows on the fly.
Tonight i only take 5 minutes to find the answer, maybe a lot of you know it before, but its new for me.
Code: Select all
#WINDOW_PARAMETERS = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget
Procedure Crea(num.l)
OpenWindow(num,100,100, 100, 200, Str(num), #WINDOW_PARAMETERS)
ButtonGadget(num, 50, 75, 40, 20, "Send" ,#PB_Button_Default)
ButtonGadget(num + 1, 50, 175, 40, 20, "Send" ,#PB_Button_Default)
EndProcedure
If OpenWindow(0,100,100, 400, 300,"memory", #WINDOW_PARAMETERS )
ButtonGadget(0, 50, 75, 40, 20, "Send" ,#PB_Button_Default)
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadget()
Case 0
Cont.l = Cont + 1
Crea(Cont)
Default
If EventGadget() = EventWindow()
CloseWindow(EventGadget())
Else
SetGadgetText(EventGadget(),Str(EventGadget()))
EndIf
EndSelect
EndIf
If EventID = #PB_Event_CloseWindow
If EventWindow() = 0
Final = 1
EndIf
CloseWindow(EventWindow())
EndIf
Until Final = 1
EndIf
End