Jump to content

Recommended Posts

Hi,

 

Is there a good tutorial out there that explains how to build a multi column listbox? I want to display the unit type in the first column and its cost in the 2nd column

 

Unit        | Cost
____________|_________
Rifleman    | 100
Grenadier   | 150
Marksman    | 200

I am using the CT_LISTNBOX and lbAddRow but for some reason it is putting two entries next to each other in 1 row instead of below each other, see screenshot here:

https://imgur.com/a/woZPgV6

 

class listboxUnitSelection: RscListNBox
		{
			idc = 1501;
			type = CT_LISTNBOX;
			onLBSelChanged = "[_this] execVM 'displayUnitDetails.sqf'";

			x = 0.35 * safezoneW + safezoneX;
			y = 0.36 * safezoneH + safezoneY;
			w = 0.2749206 * safezoneW;
			h = 0.2 * safezoneH;
			
			columns[] = {0.3, 0.6}; 
			colorDisabled[] = {1,1,1,0.3};
			disableOverflow = true;
			idcLeft = -1; 
			idcRight = -1; 
			
			class ListScrollBar : ScrollBar //ListScrollBar is class name required for Arma 3
			  {
				color[] = {1,1,1,0.6};
				colorActive[] = {1,1,1,1};
				colorDisabled[] = {1,1,1,0.3};
				thumb = "#(argb,8,8,3)color(1,1,1,1)";
				arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
				arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
				border = "#(argb,8,8,3)color(1,1,1,1)";
				shadow = 0;
			  };
		};

and here my lbAddRow

{
	hint format ["_x: \n%1", _x];
	//_ctrlUnitListBox lbAdd (_x select 1);
	_ctrlUnitListBox lnbAddRow [(_x select 1),"COL2"];
} forEach availableUnitsList;

 

Share this post


Link to post
Share on other sites

make sure CT_LISTNBOX is defined before you use it, that might be it, not sure...

Share this post


Link to post
Share on other sites
20 hours ago, gc8 said:

make sure CT_LISTNBOX is defined before you use it, that might be it, not sure...

 

Yep, I have this in my define.hpp

 

class RscListNBox
{
  access = 0;
  type = CT_LISTNBOX;// 102; 
  style =ST_MULTI;
  w = 0.4;   h = 0.4; 
  font = "TahomaB"; 
  sizeEx = 0.04; 
  colorText[] = {0.8784, 0.8471, 0.651, 1}; 
  colorBackground[] = {0, 0, 0, 1}; 
  autoScrollSpeed = -1; 
  autoScrollDelay = 5; 
  autoScrollRewind = 0; 
  arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; 
  arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; 
  columns[] = {0.3, 0.6, 0.7}; 
  color[] = {1, 1, 1, 1}; 
  colorScrollbar[] = {0.95, 0.95, 0.95, 1}; 
  colorSelect[] = {0.95, 0.95, 0.95, 1}; 
  colorSelect2[] = {0.95, 0.95, 0.95, 1}; 
  colorSelectBackground[] = {0, 0, 0, 1}; 
  colorSelectBackground2[] = {0.8784, 0.8471, 0.651, 1}; 
  drawSideArrows = 0; 
  idcLeft = -1; 
  idcRight = -1; 
  maxHistoryDelay = 1; 
  rowHeight = 0; 
  soundSelect[] = {"", 0.1, 1}; 
  period = 1; 
  shadow = 2; 
  class ScrollBar
  {
    arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
    arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
    border = "#(argb,8,8,3)color(1,1,1,1)";
    color[] = {1,1,1,0.6};
    colorActive[] = {1,1,1,1};
    colorDisabled[] = {1,1,1,0.3};
    thumb = "#(argb,8,8,3)color(1,1,1,1)";
  };
};

 

Share this post


Link to post
Share on other sites
3 hours ago, arma_max said:

Yep, I have this in my define.hpp

 

but you must also have "#define CT_LISTNBOX 102" somewhere

Share this post


Link to post
Share on other sites

That is on top of my defines.hpp

 

 

// Control types
#define CT_STATIC           0
#define CT_BUTTON           1
#define CT_EDIT             2
#define CT_SLIDER           3
#define CT_COMBO            4
#define CT_LISTBOX          5
#define CT_TOOLBOX          6
#define CT_CHECKBOXES       7
#define CT_PROGRESS         8
#define CT_HTML             9
#define CT_STATIC_SKEW      10
#define CT_ACTIVETEXT       11
#define CT_TREE             12
#define CT_STRUCTURED_TEXT  13
#define CT_CONTEXT_MENU     14
#define CT_CONTROLS_GROUP   15
#define CT_SHORTCUTBUTTON   16
#define CT_XKEYDESC         40
#define CT_XBUTTON          41
#define CT_XLISTBOX         42
#define CT_XSLIDER          43
#define CT_XCOMBO           44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT           80
#define CT_OBJECT_ZOOM      81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK        98
#define CT_USER             99
#define CT_MAP              100
#define CT_MAP_MAIN         101
#define CT_LISTNBOX         102
#define CT_CHECKBOX         77

Does anyone here maybe have a working sample mission where I can take a look?

Share this post


Link to post
Share on other sites

so you have the #include "defines.hpp" before you are declaring the "class listboxUnitSelection: RscListNBox" ?

Share this post


Link to post
Share on other sites

ok , well if everything is in order description.ext then I don't know but "style =ST_MULTI;" is probably unnecessary

 

Share this post


Link to post
Share on other sites
On 9/18/2020 at 6:12 AM, arma_max said:

for some reason it is putting two entries next to each other in 1 row instead of below each other,

No idea, your definition of the LnB work perfectly fine for me.

TEST_MISSION

Share this post


Link to post
Share on other sites

Sorry about that, looks like I forgot to hit Send on my last reply: issue was on my end because I also ran an lbAdd in another script that was adding those values to the listbox and messed it up ...

 

fixed that and now everything is working fine 🙂

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×