Jump to content
Sign in to follow this  
Guest

[SOLVED] Getting XListBox working ?

Recommended Posts

Guest

Hello everyone,

 

May someone explain how to get the XListBox working correctly ?

 

Like this WuChaoRen_ctXListBox.png

https://community.bistudio.com/wiki/DialogControls-ListBoxes#RscXListBox

 

I can't get it working. I always get strange black boxes, or boxes that take the middle of the screen where I can only see the border. That's strange. If anyone has a dialog which is working.

 

Thank you.

Share this post


Link to post
Share on other sites
Guest

UP

 

I tried with the ctrlCreate function and I get two giant arrows in front of my screen. Changing height and width does not change a thing.

 

Again if anyone can explain me how can I get it working I will be very thankfull.

 

Thank you

Share this post


Link to post
Share on other sites
Guest

Here is what I actually get.

 

 

4687ca9ec0.png

class RscXListBox
{
    idc = -1;
    type = 42;
    style = 0 + 0x10;
    font = "Zeppelin32";
    sizeEx = 0.04221;
    rowHeight = 0.03;
    color[] = {1, 1, 1, 1};
    colorText[] = {1, 1, 1, 0.75};
    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.6, 0.8392, 0.4706, 1.0};
    colorSelectBackground2[] = {0.6, 0.8392, 0.4706, 1.0};
    columns[] = {0.1, 0.7, 0.1, 0.1};
    period = 0;
    colorBackground[] = {0, 0, 0, 1};
    maxHistoryDelay = 1.0;
    autoScrollSpeed = -1;
    autoScrollDelay = 5;
    autoScrollRewind = 0;
    soundSelect[] = {"\ca\ui\data\sound\new1", 0.09, 1};
    arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
    arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
    border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; // Fill texture
    
    class ScrollBar {
        color[] = {1, 1, 1, 0.6};
        colorActive[] = {1, 1, 1, 1};
        colorDisabled[] = {1, 1, 1, 0.3};
        thumb = "\ca\ui\data\igui_scrollbar_thumb_ca.paa";
        arrowFull = "\ca\ui\data\igui_arrow_top_active_ca.paa";
        arrowEmpty = "\ca\ui\data\igui_arrow_top_ca.paa";
        border = "\ca\ui\data\igui_border_scroll_ca.paa";
    };
};

class LeftBar_Build: RscXListBox
{
	access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified)
	idc = 310; // Control identification (without it, the control won't be displayed)
	style = SL_HORZ + ST_CENTER + LB_TEXTURES; // Style

	x = LB_BUILD_FACELIST_POS_X * safezoneW + safezoneX; // Horizontal coordinates
	y = LB_BUILD_FACELIST_POS_Y * safezoneH + safezoneY; // Vertical coordinates
	w = LB_BUILD_FACELIST_WIDTH * safezoneW; // Width
	h = LB_BUILD_FACELIST_HEIGHT * safezoneH; // Height

	color[] = {1,1,1,1}; // Arrow color
	colorActive[] = {1,1,1,1}; // Selected arrow color

	sizeEx = 4; // Text size
	font = LB_BUILD_FACELIST_FONT; // Font from CfgFontFamilies
	shadow = 1; // Shadow (0 - none, 1 - N/A, 2 - black outline)
	colorText[] = {0,0,0,1}; // Text color
	colorSelect[] = {1,1,1,1}; // Selected text color
	colorDisabled[] = {1,1,0,1}; // Disabled text color
};

Share this post


Link to post
Share on other sites

I'll paste my code for this type of ListBox. It works exactly like your image so it should be good:

 

Dialog.hpp:

class WSGUIArmory_Controls: RscXListBox
		{
			idc = 1500;
			onLBSelChanged = "_this call ui_pageChange;";
			x = 0.5 * GUI_GRID_W + GUI_GRID_X;
			y = 1.5 * GUI_GRID_H + GUI_GRID_Y;
			w = 37.5 * GUI_GRID_W;
			h = 1 * GUI_GRID_H;
		};

Defines.hpp:

class RscXListBox
{
	access = 0;
	idc = CT_XLISTBOX;
	type = CT_XLISTBOX;
	style = SL_HORZ + ST_CENTER + LB_TEXTURES;
	default = 0;
	blinkingPeriod = 0;
	x = 12 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X;
	y = 17 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y;
	w = 10 * GUI_GRID_CENTER_W;
	h = 1 * GUI_GRID_CENTER_H;
	color[] = {1,1,1,1};
	colorActive[] = {1,1,1,1};
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	font = "PuristaMedium";
	shadow = 0;
	colorText[] = {1,1,1,1}; // Text color
	colorSelect[] = {1,1,1,1}; // Selected text color
	colorDisabled[] = {1,1,1,0.5}; // Disabled text color
	tooltip = ""; // Tooltip text
	tooltipColorShade[] = {0,0,0,0}; // Tooltip background color
	tooltipColorText[] = {1,1,1,0}; // Tooltip text color
	tooltipColorBox[] = {1,1,1,0}; // Tooltip frame color
	arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; // Arrow
	arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; // Arrow when clicked on
	border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; // Fill texture
	soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1};
};

Share this post


Link to post
Share on other sites
Guest

Thank you very much but nothing shows up on my screen.
 
I got this error with your control

Error loading control C:\Users\Harmdhast\Documents\Arma 3\missions\StartingMenu.Altis\description.ext/dialog_MyDialog/controls/WSGUIArmory_Controls/

EDIT: I managed to get it working but I don't have any arrows and I can't fill the list with lbAdd.

Share this post


Link to post
Share on other sites
Guest

I tried this code to fill my listbox

{
	_ctrl = _x;
	{
		_ctrl lbAdd getText (_x >> "displayName");
		_ctrl lbSetPicture [_foreachindex,getText (_x >> "texture")];
		_ctrl lbSetTooltip [_foreachindex,getText (_x >> "displayName")];
	} forEach ("isClass _x" configClasses (configFile >> "CfgRanks"));
	_ctrl lbSetCurSel 0;
} forEach  [_CT_XLISTBOX];

From here https://community.bistudio.com/wiki/List_BoxI named my control _CT_XLISTBOX but nothing shows

 

The control spawns without arrows and disabled, if I enable it it just turns from grey to dark.

852337d4ae.jpg

2f2fe2766c.jpg

 

When it's enbaled I can press invisble arrows and I hear the sound.

Adding things to the list whan enabled or disabled does not change a thing

 

Dialogs

class RscXListBox
{
	access = 0;
	idc = CT_XLISTBOX;
	type = CT_XLISTBOX;
	style = SL_HORZ + ST_CENTER + LB_TEXTURES;
	default = 0;
	blinkingPeriod = 0;
	x = 12 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X;
	y = 17 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y;
	w = 10 * GUI_GRID_CENTER_W;
	h = 1 * GUI_GRID_CENTER_H;
	color[] = {1,1,1,1};
	colorActive[] = {1,1,1,1};
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	font = "PuristaMedium";
	shadow = 0;
	colorText[] = {1,1,1,1}; // Text color
	colorSelect[] = {1,1,1,1}; // Selected text color
	colorDisabled[] = {1,1,1,0.5}; // Disabled text color
	tooltip = ""; // Tooltip text
	tooltipColorShade[] = {0,0,0,0}; // Tooltip background color
	tooltipColorText[] = {1,1,1,0}; // Tooltip text color
	tooltipColorBox[] = {1,1,1,0}; // Tooltip frame color
	arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; // Arrow
	arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; // Arrow when clicked on
	border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; // Fill texture
	soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1};
};



class mydialog {
	idd = -1; 
	onLoad = "ExecVM 'test.sqf'";                     // set to -1, because we don't require a unique ID
	movingEnable = false;           // the dialog can be moved with the mouse (see "moving" below)
	enableSimulation = false;      // freeze the game
	controlsBackground[] = { };    // no background controls needed
	objects[] = { };               // no objects needed
	 // our "Hello world" text as seen below:
	class controls 
	{
		class _CT_XLISTBOX: RscXListBox
		{
			idc = 300;
			onLBSelChanged = "";
			x = 0.2;
			y = 0.44;
			w = 0.575;
			h = 0.08;
			arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; // Arrow
			arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; // Arrow when clicked on
			border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; // Fill texture
		};
	};
};

Share this post


Link to post
Share on other sites

Here's what your dialog should look like and the dialogInit.sqf is where you use lbAdd.

 

class RscXListBox
{
	access = 0;
	idc = CT_XLISTBOX;
	type = CT_XLISTBOX;
	style = SL_HORZ + ST_CENTER + LB_TEXTURES;
	default = 0;
	blinkingPeriod = 0;
	x = 12 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X;
	y = 17 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y;
	w = 10 * GUI_GRID_CENTER_W;
	h = 1 * GUI_GRID_CENTER_H;
	color[] = {1,1,1,1};
	colorActive[] = {1,1,1,1};
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	font = "PuristaMedium";
	shadow = 0;
	colorText[] = {1,1,1,1}; // Text color
	colorSelect[] = {1,1,1,1}; // Selected text color
	colorDisabled[] = {1,1,1,0.5}; // Disabled text color
	tooltip = ""; // Tooltip text
	tooltipColorShade[] = {0,0,0,0}; // Tooltip background color
	tooltipColorText[] = {1,1,1,0}; // Tooltip text color
	tooltipColorBox[] = {1,1,1,0}; // Tooltip frame color
	arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa"; // Arrow
	arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa"; // Arrow when clicked on
	border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa"; // Fill texture
	soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1};
};



class mydialog {
	idd = -1; 
	onLoad = "[_this] execVM 'dialogInit.sqf'";                     // set to -1, because we don't require a unique ID
	movingEnable = false;           // the dialog can be moved with the mouse (see "moving" below)
	enableSimulation = false;      // freeze the game
	controlsBackground[] = { };    // no background controls needed
	objects[] = { };               // no objects needed
	 // our "Hello world" text as seen below:
	class controls 
	{
		class _CT_XLISTBOX: RscXListBox
		{
			idc = 300;
			x = 0.2;
			y = 0.44;
			w = 0.575;
			h = 0.08;
		};
	};
};
Here's the dialogInit.sqf example:

disableSerialization;

_display = _this select 0 select 0;

// Controls
_pageSel = _display displayCtrl 300;

// 0
_index = _pageSel lbAdd "Loadouts";

// 1
_index = _pageSel lbAdd "Attachments";

Share this post


Link to post
Share on other sites
Guest

Thanks a lot buddy, you made my day.

Share this post


Link to post
Share on other sites

Anyone got solution for today? Because it's still not working. I tried these definitions from here, then from official bis wiki and then from config viewer, where I found the menu of game settings. In game settings it works, but it doesn't work elsewhere. Wtf?. So I would say it's just broken..?

 

class trade_combo_inv_player
		{
			access = 0;
			type = 42;
			idc = 302;
			style = "0x400 + 0x02 +	0x10";
			font = "RobotoCondensed";
			blinkingPeriod = 0;
			sizeEx = (((((safezoneW / safezoneH) min 1.2) / 1.2) / 18) * 1);

			onLBSelChanged = "playsound 'ui_category'";
			onMouseZChanged = "";

			x = safeZoneX + safeZoneW * 0.0375;
			y = safeZoneY + safeZoneH * 0.15;
			w = safeZoneW * 0.275;
			h = safeZoneH * 0.04555556;

			arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
			arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
			border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
			deletable = 0;
			shadow = 0;
			fade = 0;

			color[] = {1,1,1,0.6};
			colorActive[] = {1,1,1,1};
			colorDisabled[] = {1,1,1,0.25};
			colorPictureDisabled[] = {1,1,1,0.25};
			colorPictureRight[] = {1,1,1,1};
			colorPictureRightDisabled[] = {1,1,1,0.25};
			colorPictureRightSelected[] = {1,1,1,1};
			colorPictureSelected[] = {1,1,1,1};
			colorSelect[] = {0.95,0.95,0.95,1};
			colorText[] = {1,1,1,1};

			soundSelect[] = {"",0.09,1};

			tooltip = ""; // Tooltip text
			tooltipColorShade[] = {0,0,0,0};
			tooltipColorText[] = {1,1,1,0};
			tooltipColorBox[] = {1,1,1,0};
		};

 

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
Sign in to follow this  

×