I have three simple windows (as a demo of the problem I'm solving): the first, the welcome window – this will be the entrance to the program. Then, window number 2, where specific actions will be performed, and window number 3, where other tasks will be performed.
I want to achieve the following three important goals:
1. The welcome window appears for 5 seconds.
2. Then, window number 2 or window number 3 opens, depending on the user's settings. The welcome window disappears after performing its welcome function.
3. Then, when I launch the window I selected earlier in the settings, for example, window number 2, I want to be able to switch between windows: in window 2, I press the button: "I want to go to window 3" and then window 2 will disappear, and window number 3 will appear. And vice versa: in window 3, I have the button "Go back to window 2" and then window 3 should disappear, and window 2 should appear.
As always, I'm counting on constructive ideas from colleagues more talented than me, for which I sincerely thank you in advance.
Code: Select all
;the_welcome_window.pb
Procedure the_welcome_window()
If OpenWindow(0, 100, 200, 400, 200, "the welcome window", #PB_Window_SystemMenu |#PB_Window_ScreenCentered)
Global hisNamea$, place_he_she_lives$
hisNamea$ = "Very nice user of my program"
place_he_she_lives$ = "Interesting town"
If LoadFont(1, "Arial", 24)
TextGadget(2, 120, 40, 200, 50, "My software")
SetGadgetFont(2, FontID(1))
EndIf
TextGadget(3, 15, 130, 153, 20, "version 1.1")
TextGadget(4, 300, 130, 253,20, Chr(169) + " John Porter")
TextGadget(5, 10, 160, 380, 20,"Program user: "+hisNamea$ + ", "+place_he_she_lives$ )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until Quit = 1
EndIf
EndProcedure
the_welcome_window()
;window_number_2.pb
Procedure window_number_2()
If OpenWindow(10, 100, 200, 300, 350, "window number 2", #PB_Window_SystemMenu |#PB_Window_ScreenCentered)
If LoadFont(11, "Arial", 24)
TextGadget(12, 25, 40, 300, 50, "window number 2")
SetGadgetFont(12, FontID(11))
EndIf
ButtonGadget(13, 55, 250, 190, 30, "I want To go To window 3")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until Quit = 1
EndIf
EndProcedure
window_number_2()
;window_number_3.pb
Procedure window_number_3()
If OpenWindow(20, 100, 200, 500, 250, "window number 3", #PB_Window_SystemMenu |#PB_Window_ScreenCentered)
If LoadFont(21, "Arial", 24)
TextGadget(22, 125, 40, 300, 50, "window number 3")
SetGadgetFont(22, FontID(21))
EndIf
ButtonGadget(23, 155, 150, 190, 30, "Go back to window 2")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until Quit = 1
EndIf
EndProcedure
window_number_3()

