Index of /xtras/menu_xtra/win
Name Last modified Size Description
Parent Directory -
screenshots/ 2017-11-26 20:48 -
menu_xtra_v01.zip 2017-11-26 20:45 1.6M
readme.txt 2017-11-27 17:28 1.5K
-- xtra Menu
-- v0.1 (c) 2017 Valentin Schmidt
Interface
=========
new object me
addItem object me, string title, *subMenuID -- returns itemID
addSeparator object me, *subMenuID
addSubMenu object me, string title, *subMenuID -- returns subMenuID
getItemChecked object me, integer itemID
setItemChecked object me, integer itemID, integer flag
setItemEnabled object me, integer itemID, integer flag
show object me, object point
Notes:
======
Menu xtra is a simple (28 KB) scripting xtra that allows to define and show
popup-menus which can be arbitrarily nested (i.e. have sub-menus).
Each xtra instance represents a single (nested) popup-menu, so if you need
multiple different menus, create multiple xtra instances.
Function 'addSubMenu' allows to add a submenu either to the main or some
already existing sub-menu, which allows arbitrarily nested menus.
A popup-menu menu can be opened programmatically at arbitrary places on the
screen, by calling 'show' (e.g. in some rightMouseDown event handler) and passing
the location as point. If the user selects a menu item, its itemID is returned.
Here some sample code showing how a popup-menu can be displayed at the point of
the stage window were the user (right-)clicked via mouse:
global gMenu
on rightMouseDown
p = _mouse.mouseLoc
-- calculate absolute coordinates on screen
sr = _movie.stage.rect
mr = _system.desktopRectList[1]
p = point(sr[1]+p[1], sr[2]+p[2])
itemID = gMenu.show(p)
put "item with ID"&&itemID&&"was selected"
end