I want to design a noBoard loading window when the program is working something, while finish the event and next close the loading window.
In loading window show time , user could not do anything



Code: Select all
Enumeration
#Win
#Timer_1_sec
#Timer_5_sec
#Btn_Quit
#Win_Wait
#Txt_Timer
EndEnumeration
OpenWindow(#Win, 0, 0, 640, 480, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#Btn_Quit, WindowWidth(#Win) - 100, WindowHeight(#Win) - 40, 80, 25, "Quitter")
AddWindowTimer(#Win, #Timer_1_sec, 1000)
AddWindowTimer(#Win, #Timer_5_sec, 5000)
OpenWindow(#Win_Wait, 0, 0, 200, 100, "", #PB_Window_ScreenCentered | #PB_Window_BorderLess)
TextGadget(#Txt_Timer, 50, 50, 100, 15, "", #PB_Text_Center)
SetWindowColor(#Win_Wait, #Gray)
StickyWindow(#Win_Wait, #True)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Timer
Select EventTimer()
Case #Timer_1_sec
If IsWindow(#Win_Wait)
i + 1
SetGadgetText(#Txt_Timer, Str(i) + " Secs")
EndIf
Case #Timer_5_sec
RemoveWindowTimer(#Win, #Timer_5_sec)
CloseWindow(#Win_Wait)
EndSelect
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #Btn_Quit
Break
EndSelect
EndSelect
ForEver
Code: Select all
Procedure DoEvents()
Protected Event.l
Repeat
Event = WindowEvent()
If Event = 0
Sleep_(0)
EndIf
Until Event = 0
EndProcedure
;waiting window
Procedure SetLoadingWin(opeOrClo)
If opeOrClo
OpenWindow_waiting()
StickyWindow(Window_waiting, #True)
SetActiveWindow(Window_waiting)
DisableWindow(Window_main, #True)
DoEvents()
Else
DisableWindow(Window_main, #False)
If IsWindow(Window_waiting)
CloseWindow(Window_waiting)
EndIf
EndIf
EndProcedure
Code: Select all
;-TOP
EnableExplicit
; -----------------------------------------------------------------------------
Enumeration windows
#Main
#Dialog
EndEnumeration
Enumeration menus
#MainMenu
EndEnumeration
Enumeration menuitems
#MainMenuExit
#MainMenuDialog
EndEnumeration
Enumeration gadgets
#MainList
#DialogString
#DialogOk
EndEnumeration
; -----------------------------------------------------------------------------
Global ExitApplication
; -----------------------------------------------------------------------------
Procedure OpenDialogWindow()
If OpenWindow(#Dialog, #PB_Ignore, #PB_Ignore, 300, 80, "Dialog Window", #PB_Window_SystemMenu, WindowID(#Main))
StringGadget(#DialogString, 10, 10, 280, 25, "")
ButtonGadget(#DialogOk, 150 - 30, 45, 60, 25 , "Ok")
DisableWindow(#Main, 1)
EndIf
EndProcedure
; -----------------------------------------------------------------------------
Procedure DoEventDialog()
Select Event()
Case #PB_Event_CloseWindow
DisableWindow(#main, 0)
CloseWindow(#Dialog)
Case #PB_Event_Gadget
Select EventGadget()
Case #DialogOk
AddGadgetItem(#MainList, - 1, GetGadgetText(#DialogString))
DisableWindow(#main, 0)
CloseWindow(#Dialog)
EndSelect
EndSelect
EndProcedure
; -----------------------------------------------------------------------------
Procedure Main()
Protected Event
If OpenWindow(#main, #PB_Ignore, #PB_Ignore, 800, 600, "Main Window", #PB_Window_SystemMenu)
CreateMenu(#MainMenu, WindowID(#Main))
MenuTitle("&File")
MenuItem(#MainMenuDialog, "&Open Dialog")
MenuItem(#MainMenuExit, "E&xit")
ListViewGadget(#MainList, 0, 0, WindowWidth(#Main), WindowHeight(#Main) - MenuHeight())
; Event Loop
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_CloseWindow
If EventWindow() = #Main
ExitApplication = 1
EndIf
Case #PB_Event_Menu
Select EventMenu()
Case #MainMenuExit
ExitApplication = 1
Case #MainMenuDialog
OpenDialogWindow()
EndSelect
EndSelect
; Do dialog events
Select EventWindow()
Case #Dialog
DoEventDialog()
EndSelect
Until ExitApplication
EndIf
EndProcedure : Main()
End
; -----------------------------------------------------------------------------