How long stores EventMenu() the last clicked menu ID?
How long stores EventMenu() the last clicked menu ID?
As long as the next menu event is triggered? Or can it be emptied in other ways?
Re: How long stores EventMenu() the last clicked menu ID?
EventMenu() is only valid if the event #PB_Event_Menu is pending.
The functions EventMenu, EventGadget, and EventTimer access the internal event system of PB to obtain the data Event Object.
See the PB PostEvent help for more information.
This means that calling EventMenu, EventGadget, or EventTimer produces the same result.
One could have used just one EventObject function, but it looks better in the programme.
The functions EventMenu, EventGadget, and EventTimer access the internal event system of PB to obtain the data Event Object.
See the PB PostEvent help for more information.
This means that calling EventMenu, EventGadget, or EventTimer produces the same result.
One could have used just one EventObject function, but it looks better in the programme.
Code: Select all
;-TOP
#ProgramTitle = "Main Window"
#Version = "v1.01.1"
Enumeration Windows
#Main
EndEnumeration
Enumeration Menus
#MainMenu
EndEnumeration
Enumeration MenuItems
#MainMenuExitApplication
#MainMenuInfo = 100
EndEnumeration
Enumeration Gadgets
EndEnumeration
Enumeration Status
#MainStatusBar
EndEnumeration
Global ExitApplication
; ----
Procedure UpdateWindow()
Protected dx, dy
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Resize gadgets
EndProcedure
; ----
Procedure Main()
Protected dx, dy
#MainStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
If OpenWindow(#Main, #PB_Ignore, #PB_Ignore, 800, 600, #ProgramTitle , #MainStyle)
; Menu
CreateMenu(#MainMenu, WindowID(#Main))
MenuTitle("File")
MenuItem(#MainMenuInfo, "&Info")
MenuBar()
MenuItem(#MainMenuExitApplication, "E&xit")
; For Mac
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
If Not IsMenu(#MainMenu)
CreateMenu(#MainMenu, WindowID(#Main))
EndIf
MenuItem(#PB_Menu_About, "")
MenuItem(#PB_Menu_Preferences, "")
CompilerEndIf
; StatusBar
CreateStatusBar(#MainStatusBar, WindowID(#Main))
AddStatusBarField(#PB_Ignore)
StatusBarText(#MainStatusBar, 0, " " + #Version)
; Gadgets
dx = WindowWidth(#Main)
dy = WindowHeight(#Main) - StatusBarHeight(#MainStatusBar) - MenuHeight()
; Bind events
BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), #Main)
; Main loop
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
ExitApplication = #True
Case #PB_Event_Menu
Select EventMenu()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
Case #PB_Menu_About
MessageRequester("Info", #ProgramTitle + " " + #Version)
Case #PB_Menu_Preferences
Case #PB_Menu_Quit
ExitApplication = #True
CompilerEndIf
Case #MainMenuExitApplication
ExitApplication = #True
Case #MainMenuInfo
Debug "Event Object"
Debug EventMenu()
Debug EventGadget()
Debug EventTimer()
Debug "---"
EndSelect
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until ExitApplication
EndIf
EndProcedure : Main()
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive

