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

From Graal Bible
No edit summary
(Added picture, description and an example script)
Line 1: Line 1:
Inherits from [[Creation/Dev/Script/Client/GuiArrayCtrl|GuiArrayCtrl]].
Inherits from [[Creation/Dev/Script/Client/GuiArrayCtrl|GuiArrayCtrl]].
=Description=
[[Image: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 [[Creation/Dev/Script/Client/GuiScrollCtrl|GuiScrollCtrl]].


=Variables=
=Variables=
Line 98: Line 104:


onIconResized(newwidth,newheight) - the icon size has been changed via setIconSize()
onIconResized(newwidth,newheight) - the icon size has been changed via setIconSize()
=Example=
  new GuiScrollCtrl("Test_ListScroll") {
    profile = GuiBlueScrollProfile;
    x = 370;
    y = 400;
    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);
    }
  }

Revision as of 18:17, 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 = 370;
   y = 400;
   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);
   }
 }