Menu Utility


My Requirement is to have a Menu on a MenuBar in a Window.

I am implementing this by having a hotkey to list down the appropriate Menu.
Say I have 3 Menu

File Edit View

whose hotkey are alt+f, alt+e, alt+v resp.

Now when I press ‘alt+f’ ‘File’ Menu is displayed as expected. But now if I press right arrow key the focus shifts to ‘Edit’ Menubutton but ‘Edit’ Menu is not displayed. Only if I press ‘Enter’ or hotkey ‘Alt+e’ My menu is getting displayed.

Find a sample project attached.

  1. Run Menu_Test
  2. Press alt+f.
    file Menu is displayed
  3. Now press right arrow key
    Focus shifts to ‘Edit’ MenuButton but but Edit menu is not displayed. Here I want My Edit Menu to be displayed. If i press right arrow key againg my focus shifts to ‘View’ MenuButton but View menu is not displayed.

And another query related to PtFileSelection

I want to open a new file using PtFileSelection. When i select a file from the list using up/down arrow keys, the highlighted file name is not reflected in ‘Name’ section of File Selector. only if I press enter or I click on the file by mouse the name gets reflected.

  1. Open a terminal

  2. ped xyz

  3. ‘Alt+f’-> Open ( File Selector opens )

  4. Now using up down arrow keys select files.

    Here as and when the file is selected Name of the file does not get reflected in ‘Name’ section. We got click it with mouse to reflect the name in ‘Name’ section of File Selector.

I’ll try to answer your first question. You need to add a module callback on the Pt_CB_ARM event (see … enumodules and scroll down to the “Using a menu module” section)

I’ve attached an updated project although I’m using QNX 6.5.0 with Momentics 4.7 and I see you have 4.5 so it may not work on your system. All I’ve done is add the callback to each of the ARM events.

Its working as expected.
Do you have any idea about my second query i.e. regarding PtFileSelection ?

I believe you’ll need to add a callback on Pt_CB_FS_SELECTION where you’ll set the ‘Name’ field to the currently selected item. I don’t know of an automatic way of making this happen, but I haven’t played around with the PtFileSel widget either.