Author Topic: Listing a certain object in a GUI.  (Read 847 times)

I've long wondered what the correct function is to list objects in a scroll control. I'm trying to make a drop down box that shows all the weapons, but I'm not sure exactly how to do it.

You need to add a GuiTextListCtrl within the GuiScrollCtrl, and then you can use:
Code: [Select]
GuiTextListCtrl.addRow(int id, string text, int index=0)to add text to the control.

Example:
Code: [Select]
function GuiControl::onWake(%this)
{
   GuiTextListCtrl.clear();

   for(%i = 0; %i < DataBlockGroup.getCount(); %i++)
   {
      %obj = DataBlockGroup.getObject(%i);

      if(%obj.getClassName() $= "ItemData" && %obj.uiName !$= "")
         GuiTextListCtrl.addRow(%i, %obj.uiName);
   }
}

Where GuiControl is the name of the Gui, onWake is the function called when the Gui is opened, and GuiTextListCtrl is the name of the Text List.

I'm good with GUIs, I was asking for just the function.
Thankyou.