This function works like setParent(), but targets menus whose only the handle is known. They may have been created from a memory template. Since such a menu has no caption, you must supply one.
See Also: attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
This will cause the menu(s) supplied in pMenu to be linked to
the control pId such that when the righthand mouse button is pressed,
the menu will pop up next to the mouse pointer.
You can have different menus popup depending on the combination of
Ctrl and Shift keys you have pressed. You do this by supplying up to four
menu ids in pMenu, one for no keys pressed, one for shift key, one for
control key, and another for both shift and control keys pressed.
Each value in pMenu is either a Menu id, 0, -1, or a sequence
of the form {MenuId, XOffset, YOffset}.
If a simple menu id, then this is the popup menu that will display when
the user right-clicks in the control.
If -1, then the corresponding current value is retained. Use this to
skip over setting previous values of menu ids.
If 0, then the corresponding menu id is cleared and the popup will
not display.
If a sequence, then the XOffset and YOffset are used to position
the menu relative to the mouse pointer. The default values are -6 and -6
respectively. Use this when you need the menu to be shown is different
position.
First you need to define the menus and any handlers for them, then you can attach them to one or more controls.
Example
-- Define two menus. MenuOne = create(Menu, "One", MainWindow, 0, 0, 0,0, 0) M1_Item1 = create(MenuItem, "Item 1.1", MenuOne, 0, 0, 0,0, 0) M1_Item2 = create(MenuItem, "Item 1.2", MenuOne, 0, 0, 0,0, 0) M1_Item3 = create(MenuItem, "Item 1.3", MenuOne, 0, 0, 0,0, 0) MenuTwo = create(Menu, "Two", MainWindow, 0, 0, 0,0, 0) M2_Item1 = create(MenuItem, "Item 2.1", MenuTwo, 0, 0, 0,0, 0) M2_Item2 = create(MenuItem, "Item 2.2", MenuTwo, 0, 0, 0,0, 0) M2_Item3 = create(MenuItem, "Item 2.3", MenuTwo, 0, 0, 0,0, 0) setHandler(M1_Item1, w32HClick, routine_id("Click_Item11")) setHandler(M1_Item2, w32HClick, routine_id("Click_Item12")) setHandler(M1_Item3, w32HClick, routine_id("Click_Item13")) setHandler(M2_Item1, w32HClick, routine_id("Click_Item21")) setHandler(M2_Item2, w32HClick, routine_id("Click_Item22")) setHandler(M2_Item3, w32HClick, routine_id("Click_Item23"))-- Now attach popups for normal and ctrl keys prevMenus = attachPopup(SomeFld, {MenuOne, -- Normal (no keys) -1, -- ignore Shift -- Note the changed X-Y offsets. {MenuTwo,-20,-10} -- Ctrl key })
See Also: attachMenuHandle, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
ids is a list of menuitems that form a logical group of items,
in which only one can be marked witha 'radio-button' icon.
This routine ensures that only one item from the group will be
marked. Any that were previously marked will be 'turned off'
Note 1. The items do not have to be in the same menu.
Note 2. A given menu item can only be in one radio group.
Example:
-- set the current loudness level. defineMenuRadioGroup({miPianissimo, miPiano, piModerato, miForte, miFortissimo}) . . . setCheck( miForte, w32True) -- now, all items of the same group are unchecked, except for miForte
See Also: attachMenuHandle, attachPopup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
This returns zero if menu is not an appropriate control type.
Example:
-- count size of TheList integer countcount = getCount( TheMenu )
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
id is the id of a menu (item).
Example
integer pos pos = getMenuPosn(miSave)
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, inMenuBar, removeMenu, setMenuItemBitmaps, skipF10
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, removeMenu, setMenuItemBitmaps, skipF10
item is a 0-based index if flag is w32False, else an item id which must belong to the menu id (or the menu bar of the window id). If reuse is w33False, Windows is asked to free the memory of the menu, effectively destroying item. By passing another value, and if item is a menu, the function will leave the internal data alone and return the handle.
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, setMenuItemBitmaps, skipF10
id is the identifier of the menu item to be considered. If bitmap is an atom, it is the handle to the bitmap displayed by the item. If it is a sequence starting with a pair, the pair is {unchecked mark handle,checked mark handle}, and these marks will be set. If it is an empty sequence, no attempt to change anything will be made. Otherwise, bitmap is some text to be displayed instead of the current bitmap, if any. The returned value always has 3 elements, unless the function fails in any way, in which case it returns {}.
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, skipF10
By default, the F10 key sets focus on the menubar. If NewValue is w32True, then the behaviour is changed so that the F10 key does not set focus on the menubar. Passing w32GetValue will just return the current value of the flag.
Example:
integer PrevF10Flag PrevF10Flag = skipF10( w32True )
See Also: attachMenuHandle, attachPopup, defineMenuRadioGroup, Get the count of items in /i menu , getCount, getMenuBar, getMenuPosn, inMenuBar, removeMenu, setMenuItemBitmaps