Item 12 of 278 Previous | Next

1
Vote

Tab Menu crashes when using hotkeys with separator in Start item form quick menu

description

Steps:

1) Create a Tab Menu (easiest is to use the Menu Designer).
2) Subclass frmStartMenu to create a form class to use when clicking the Start item.
3) In the Init method of the form, add popup items to form, specifying hot keys. Include at least one separator item. This code works for this:

LPARAMETERS voMenuItem, voTabMenu

IF DODEFAULT(m.voMenuItem, m.voTabMenu)
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("New", "NORM", "N")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Open", "NORM", "O")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Close", "NORM", "C")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Save", "NORM", "S")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Revert", "NORM", "R")
ThisForm.cntMenuItems.cntQuickMenu.AddPopupItem("-","SEP")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Print", "NORM", "P")
THISFORM.cntMenuItems.cntQuickMenu.Addpopupitem("Preferences", "NORM", "F")
ENDIF

4) Add code to the menu's Setup to specify the form class you created.
5) Generate the menu using Tab Menu's GenMenu replacement.
6) Set up a top-level form to host the whole thing. For this test, probably sufficient to just have it top-level and no additional code.
7) Set up a main program to test. At a minimum:

SET PATH TO <tab menu classes and images>
SET CLASSLIB TO TabMenu.VCX, <class containing form created in step 3>

PUBLIC goForm

DO FORM <your main form created in step 6> NAME goForm
DO <your generated menu>.MPR

READ EVENTS

goForm.RELEASE()
RELEASE goForm

8) Click the Start item.
9) Hit the ALT key to show the hotkeys
10) Hit any of the specified hotkeys.

Observed: Error "Property 'cHotKey' is not found."

Notes: The problem is that the loop checking hotkeys doesn't omit the separator item.

No files are attached

comments