PopUp Menus
Posted: Mon Dec 30, 2019 7:45 pm
Alright so I seem to have an ongoing issue with my popup menus. They seem to be affecting my main Menubar. For example when I click on File: Save As it seems to trigger one of my Popup menu events instead. When I disable my popup menus all seems o.k. So I am guessing it's an enumeration issue?
I use PureVision for my GUI creation. So I have to include that file obviously. I used to use PureForm but for some reason that keeps closing down or worse yet keeps changing windows while trying edit so I switched to PureVision.
This is the start of things. If I relocated the Enumeration section other things get messed up. If I change the location of the CreatePopupMenu section some things screw up. I have seen the examples. People usually use a number where my #MyPopUpMenu1 is located etc. I've tried that. That is how I started. That really messed things up. So I am at a loss how to make things work here.
So currently when I click on File: Save As in my Menubar it triggers the MenuItem(#PopupMenu_Cancel, "Cancel") event. I have no idea why. And if I click on Edit:Settings it also triggers a PopupMenu event. I just don't get it. I'm about to get rid of the Popup menus and figure out something else.
File:Open will act as those the Popup Menu : Duplicate has been selected. Just odd behavior.
But yet my File:Exit will in fact exit the program.
And it would appear that my Popup Menus do in fact work correctly where they were meant to. Just the MenuBar that is screwing up.
What other code do you need to see to better understand? Or what other information might you need to help better understand? I'm sure I have not explained it correctly or with enough detail to help to understand my issue.
Updated with the correct code.
I use PureVision for my GUI creation. So I have to include that file obviously. I used to use PureForm but for some reason that keeps closing down or worse yet keeps changing windows while trying edit so I switched to PureVision.
Code: Select all
UseSQLiteDatabase()
UseJPEGImageDecoder()
UseTGAImageDecoder()
UsePNGImageDecoder()
UseTIFFImageDecoder()
UseGIFImageDecoder()
Enumeration
#MyPopUpMenu
#PopupMenu_ViewEdit
#PopupMenu_Delete
#PopupMenu_Duplicate
#PopupMenu_Cancel
#MyPopUpMenu1
#PopupMenu1_ViewEdit
#PopupMenu1_Cancel
#MyPopUpMenu2
#PopupMenu2_ViewEdit
#PopupMenu2_Cancel
EndEnumeration
; Pure PDF Stuff
#PurePDF_Include=1
XIncludeFile "PurePDF.pb"
Declare Header()
Declare Footer()
Declare ReportTitleClear()
Global DBFullName.s, DBName.s, DBProgramName$, DBVersion$, DBVersionC$, DBFullName$
Global DataListEdit$, NewRecord_DataItem, DataItemPullResult, ModifyResult, ItemModify, REGISTERFLAG, PhotoDocsModifyResult, PictureDocPullResult
Global WebsiteButtonChosen$, Website_ModifyResult
Global PrefName$, PrefEMail$, PrefRegistrationCode$, PrefLastUsed$
Global ImageFilename.s = "", pictureSize, *picture, GlobalImageName$
Global ReportTitle$, ReportTitleOther$
;- XIncludes
XIncludeFile "ListIconGadgetInclude.pbi"
;XIncludeFile "firearms-gui2.pbf"
;XIncludeFile "firearms-dataprogress.pbf"
;XIncludeFile "firearms-datalistgui.pbf"
XIncludeFile "Firearms-GUI3_Windows.pb"
XIncludeFile "firearms-datalistediting.pb"
XIncludeFile "firearms-firearms.pb"
XIncludeFile "firearms-ammunition.pb"
XIncludeFile "firearms-accessories.pb"
XIncludeFile "firearms-maintenance.pb"
XIncludeFile "firearms-scoring.pb"
XIncludeFile "firearms-reloading.pb"
XIncludeFile "firearms-reloadingrecipes.pb"
XIncludeFile "firearms-setup.pb"
Declare AutocompleteComboBox(ComboBox.l)
Declare UnMangle(regname$, code$)
Declare OpenDB()
Declare CreateTable()
Declare HelpScreen()
Declare HelpScreen_Specifics()
Declare AboutScreen()
Declare Toolbar_Active(selectedtoolbar$)
Declare ViewDocumentsSaved()
Declare NewDatabase()
Declare OpenExistingDatabase()
Declare SaveAsDatabase()
;-Program Name and Version
DBProgramName$ = "Firearms Inventory"
DBVersion$ = " v 0.72.0b" ;- Version Number
DBVersionC$ = " v " + #PB_Editor_CreateExecutable + "." + #PB_Editor_BuildCount + "." + #PB_Editor_CompileCount
DataSection
PopulatedFlag:
IncludeBinary "Images\lightbulb.ico"
NonPopulatedFlag:
IncludeBinary "Images\lightbulb-off.ico"
EndDataSection
Window_Form1()
;SetWindowTitle(#Window_Form1, DBProgramName$ + DBVersion$)
;-Create Popup Menus
If CreatePopupMenu(#MyPopUpMenu)
MenuItem(#PopupMenu_ViewEdit, "View/Edit")
MenuItem(#PopupMenu_Delete, "Delete")
MenuItem(#PopupMenu_Duplicate, "Duplicate")
MenuBar()
MenuItem(#PopupMenu_Cancel, "Cancel")
EndIf
;
; ;For Firearms Accessories ListIcon
If CreatePopupMenu(#MyPopUpMenu1)
MenuItem(#PopupMenu1_ViewEdit, "View/Edit")
MenuBar()
MenuItem(#PopupMenu1_Cancel, "Cancel")
EndIf
;
; ;For Firearms Maintenance ListIcon
If CreatePopupMenu(#MyPopUpMenu2)
MenuItem(#PopupMenu2_ViewEdit, "View/Edit")
MenuBar()
MenuItem(#PopupMenu2_Cancel, "Cancel")
EndIf
So currently when I click on File: Save As in my Menubar it triggers the MenuItem(#PopupMenu_Cancel, "Cancel") event. I have no idea why. And if I click on Edit:Settings it also triggers a PopupMenu event. I just don't get it. I'm about to get rid of the Popup menus and figure out something else.
File:Open will act as those the Popup Menu : Duplicate has been selected. Just odd behavior.
But yet my File:Exit will in fact exit the program.
And it would appear that my Popup Menus do in fact work correctly where they were meant to. Just the MenuBar that is screwing up.
What other code do you need to see to better understand? Or what other information might you need to help better understand? I'm sure I have not explained it correctly or with enough detail to help to understand my issue.
Updated with the correct code.