Creation/Dev/Script/Client/GuiPopUpMenuCtrl: Difference between revisions
From Graal Bible
mNo edit summary |
Pooper200000 (talk | contribs) No edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:Scripting Reference]] | |||
Inherits [[Creation/Dev/Script/Client/GuiTextCtrl|GuiTextCtrl]]. | |||
=Description= | |||
[[Image:Guicontrol_combobox.png]] | |||
Displays a 'Combo' box where you can click on the button on the right side to let a menu popup and select an option from a list, which is then displayed in the box. This works similar to a [[Creation/Dev/Script/Client/GuiTextListCtrl|GuiTextListCtrl]], use ''addrow'' for adding new entries, then ''setSelectedRow'' to automatically display an option to not have the box being empty at the start. | |||
This control is using a [[Creation/Dev/Script/Client/GuiScrollCtrl|GuiScrollCtrl]] and a [[Creation/Dev/Script/Client/GuiTextListCtrl|GuiTextListCtrl]] for displaying the option list. You can change the look of that list by modifying the variables ''textprofile'' and ''scrollprofile''. | |||
=Variables= | |||
<pre> | <pre> | ||
clipcolumntext - boolean | clipcolumntext - boolean | ||
columns - string - of format "0 16", offset of the tabulators | columns - string - of format "0 16", offset of the tabulators | ||
Line 20: | Line 33: | ||
textprofile - object | textprofile - object | ||
width - integer | width - integer | ||
</pre> | |||
=Functions= | |||
<pre> | |||
addrow(int, str) - returns object - the added row | addrow(int, str) - returns object - the added row | ||
addtext(str, int) - deprecated, use addRow() instead | addtext(str, int) - deprecated, use addRow() instead | ||
Line 49: | Line 68: | ||
rowcount() - returns integer | rowcount() - returns integer | ||
rowcount() - returns integer | rowcount() - returns integer | ||
seticonsize(int, int) | seticonsize(int, int) - sets the width and height of the icons | ||
for the entries, maximum size is 64x64 | |||
setrowactivebyid(int, bool) | setrowactivebyid(int, bool) | ||
setrowbyid(int, str) | setrowbyid(int, str) | ||
Line 56: | Line 76: | ||
setselectedrow(int) | setselectedrow(int) | ||
sort() | sort() | ||
</pre> | |||
=Events= | |||
onSelect(entryid,entrytext,entryindex) - a menu entry has been selected | |||
onCancel() - the menu collapsed without selecting any entry | |||
=Example= | |||
<pre> | |||
new GuiPopUpMenuCtrl("Test_Combo") { | |||
profile = GuiBluePopUpMenuProfile; | |||
textprofile = GuiBlueTextListProfile; | |||
scrollprofile = GuiBlueScrollProfile; | |||
x = 10; | |||
y = 10; | |||
width = 160; | |||
height = 20; | |||
clearrows(); | |||
addrow(0,"ComboBox"); | |||
addrow(1,"Second Row"); | |||
setSelectedRow(0); | |||
} | |||
</pre> | </pre> |
Latest revision as of 23:54, 15 February 2010
Inherits GuiTextCtrl.
Description
Displays a 'Combo' box where you can click on the button on the right side to let a menu popup and select an option from a list, which is then displayed in the box. This works similar to a GuiTextListCtrl, use addrow for adding new entries, then setSelectedRow to automatically display an option to not have the box being empty at the start.
This control is using a GuiScrollCtrl and a GuiTextListCtrl for displaying the option list. You can change the look of that list by modifying the variables textprofile and scrollprofile.
Variables
clipcolumntext - boolean columns - string - of format "0 16", offset of the tabulators enumerate - boolean fitparentwidth - boolean groupsortorder - string iconheight - integer (read only) iconwidth - integer (read only) maxpopupheight - integer profile - object resizecell - boolean rows - object (read only) rows - object (read only) scrollprofile - object selected - object (read only) sortcolumn - integer sortmode - string sortorder - string textprofile - object width - integer
Functions
addrow(int, str) - returns object - the added row addtext(str, int) - deprecated, use addRow() instead clearrows() clearselection() close() findtext(str) - returns integer findtext(str) - returns integer - row index findtextid(str) - returns integer - row id forceclose() forceonaction() getrowatpoint(int, int) - returns integer - row index getrowidatpoint(int, int) - returns integer - row id getrownumbyid(int) - returns integer getselected() - returns integer getselectedid() - returns integer - row id getselectedids() - returns object - array of row ids getselectedrow() - returns integer - row index getselectedrows() - returns object - array of row indices getselectedtext() - returns string insertrow(int, int, str) - returns object - the inserted row isidselected(int) - returns boolean isrowselected(int) - returns boolean makevisible(int) makevisiblebyid(int) open(int, int) removerow(int) removerowbyid(int) rowcount() - returns integer rowcount() - returns integer seticonsize(int, int) - sets the width and height of the icons for the entries, maximum size is 64x64 setrowactivebyid(int, bool) setrowbyid(int, str) setselected(int) setselectedbyid(int) setselectedrow(int) sort()
Events
onSelect(entryid,entrytext,entryindex) - a menu entry has been selected
onCancel() - the menu collapsed without selecting any entry
Example
new GuiPopUpMenuCtrl("Test_Combo") { profile = GuiBluePopUpMenuProfile; textprofile = GuiBlueTextListProfile; scrollprofile = GuiBlueScrollProfile; x = 10; y = 10; width = 160; height = 20; clearrows(); addrow(0,"ComboBox"); addrow(1,"Second Row"); setSelectedRow(0); }