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

From Graal Bible
(Added picture, description and an example script)
m (→‎Example: Fixed the position of the control in the script example)
Line 109: Line 109:
   new GuiScrollCtrl("Test_ListScroll") {
   new GuiScrollCtrl("Test_ListScroll") {
     profile = GuiBlueScrollProfile;
     profile = GuiBlueScrollProfile;
     x = 370;
     x = 10;
     y = 400;
     y = 10;
     width = 160;
     width = 160;
     height = 80;
     height = 80;

Revision as of 18:24, 16 September 2006

Inherits from GuiArrayCtrl.

Description

Guicontrol textlist.png

This control is displaying a list. Each row can have a text and an icon, also the text can be divided into several columns (using the columns offset array and tabulators in the text). Most of the time this control is put in a GuiScrollCtrl.

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)

resizecell - boolean

rows[] - array of GuiTextListEntry

selected - object (read only)

sortcolumn - integer

sortmode - string

sortorder - string


Functions

addrow(int, str) - returns object - the added row

clearrows()

clearselection()

findtext(str) - returns integer - row index

findtextid(str) - returns integer - row id

getrowatpoint(int, int) - returns integer - row index

getrowidatpoint(int, int) - returns integer - row id

getrownumbyid(int) - 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)

removerow(int)

removerowbyid(int)

rowcount() - returns integer

seticonsize(int, int)

setrowactivebyid(int, bool)

setrowbyid(int, str)

setselectedbyid(int)

setselectedrow(int)

sort()


Events

onSelect(entryid,entrytext,entryindex) - a row has been selected

onDblClick(entryid,entrytext,entryindex) - is invoked when the mouse is double-clicked while being over a row

onDeleteKey(entryid,entrytext,entryindex) - the delete key was pressed while a row was selected

onOpenMenu(entryid,entrytext,entryindex) - is invoked when the right mouse button has been clicked while the mouse is over a row

onIconResized(newwidth,newheight) - the icon size has been changed via setIconSize()

Example

 new GuiScrollCtrl("Test_ListScroll") {
   profile = GuiBlueScrollProfile;
   x = 10;
   y = 10;
   width = 160;
   height = 80;
   hScrollBar = "dynamic";
   vScrollBar = "dynamic";
   new GuiTextListCtrl("Test_List") {
     profile = GuiBlueTextListProfile;
     x = y = 0;
     width = 140;
     fitparentwidth = true;
     
     clearrows();
     addrow(0,"TextList");
     addrow(1,"Second line");
     setSelectedRow(1);
   }
 }