Creation/Dev/Script/Client/GuiMenuCtrl: Difference between revisions

From Graal Bible
mNo edit summary
 
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<pre>
[[Category:Scripting Reference]]
    GuiMenuCtrl (GuiControl):
Inherits [[Creation/Dev/Script/Client/GuiControl|GuiControl]].
      iconheight - integer (read only)
 
      iconwidth - integer (read only)
=Description=
      addmenu(str) - returns object
 
      clearmenus()
[[Image:Guicontrol_menu.png]]
      findmenu(str) - returns object
 
      removemenu(str)
This control can be used to display a regular window menu. Use a different ''profile'' to display it either transparent or opaque. With ''addmenu'' you can add sub menus, which are of type [[Creation/Dev/Script/Client/GuiContextMenuCtrl|GuiContextMenuCtrl]] (the same like right-click menus, except that you can additionally specify an icon).
      seticonsize(int, int)
 
</pre>
 
=Variables=
 
iconheight - integer (read only)
 
iconwidth - integer (read only)
 
menus[] - array of [[Creation/Dev/Script/Client/GuiContextMenuCtrl|GuiContextMenuCtrl]], each submenu also has an icon ([[Creation/Dev/Script/Client/TDrawingPanel|TDrawingPanel]])
 
=Functions=
 
addmenu(str) - returns object
 
clearmenus()
 
findmenu(str) - returns object
 
removemenu(str)
 
seticonsize(int, int) - sets the width and height of the icons for the entries, maximum size is 64x64
 
=Events=
 
onSelect(menuname,entryid,entrytext,entryindex) - an entry of a submenu has been selected
 
onCancel() - a submenu has been collapsed without selecting an entry
 
onIconResized(newwidth,newheight) - the icons size has been modified (via setIconSize())
 
 
=Example=
 
  new GuiMenuCtrl("Test_Menu") {
    profile = GuiBlueTextEditProfile;
    x = 10;
    y = 10;
    width = 160;
    height = 20;
    clearmenus();
    with (addmenu("File")) {
      profile = GuiBluePopUpMenuProfile;
      textprofile = GuiBlueTextListProfile;
      addrow(0,"Open");
      addrow(-1,"-");
      addrow(1,"Close");
    }
    with (addmenu("Edit")) {
      profile = GuiBluePopUpMenuProfile;
      textprofile = GuiBlueTextListProfile;
      addrow(0,"Find");
    }
  }

Latest revision as of 23:54, 15 February 2010

Inherits GuiControl.

Description

Guicontrol menu.png

This control can be used to display a regular window menu. Use a different profile to display it either transparent or opaque. With addmenu you can add sub menus, which are of type GuiContextMenuCtrl (the same like right-click menus, except that you can additionally specify an icon).


Variables

iconheight - integer (read only)

iconwidth - integer (read only)

menus[] - array of GuiContextMenuCtrl, each submenu also has an icon (TDrawingPanel)

Functions

addmenu(str) - returns object

clearmenus()

findmenu(str) - returns object

removemenu(str)

seticonsize(int, int) - sets the width and height of the icons for the entries, maximum size is 64x64

Events

onSelect(menuname,entryid,entrytext,entryindex) - an entry of a submenu has been selected

onCancel() - a submenu has been collapsed without selecting an entry

onIconResized(newwidth,newheight) - the icons size has been modified (via setIconSize())


Example

 new GuiMenuCtrl("Test_Menu") {
   profile = GuiBlueTextEditProfile;
   x = 10;
   y = 10;
   width = 160;
   height = 20;
   clearmenus();
   with (addmenu("File")) {
     profile = GuiBluePopUpMenuProfile;
     textprofile = GuiBlueTextListProfile;
     addrow(0,"Open");
     addrow(-1,"-");
     addrow(1,"Close");
   }
   with (addmenu("Edit")) {
     profile = GuiBluePopUpMenuProfile;
     textprofile = GuiBlueTextListProfile;
     addrow(0,"Find");
   }
 }