Jump to content
Sign in to follow this  
CorkyOutkast

Button Change Listbox?

Recommended Posts

Hey everyone I am stuck again at this point trying to figure this out. I have a button that when pressed I would like for it to populate a listbox with items I have already defined in my action.sqf. I tried the onbuttonclick to no avail. Below is the button and the action.sqf of what im trying to call into the listbox and the listbox as well. Any help would be great!

Button <--- Located in dialogs.hpp

class TEST_BUTTON: RscButton
{
idc = -1;
text = "TEST";
colorBackground[] = { 0.04, 0.4, 0.9, 1 };
x = 0.381442 * safezoneW + safezoneX;
y = 0.312933 * safezoneH + safezoneY;
w = 0.0412377 * safezoneW;
h = 0.0550198 * safezoneH;
};

Listbox <---- Located in the same location as the button dialogs.hpp

class TEST_LISTBOX: RscListbox
{
idc = 2907;
x = 0.427834 * safezoneW + safezoneX;
y = 0.312933 * safezoneH + safezoneY;
w = 0.146394 * safezoneW;
h = 0.363131 * safezoneH;
};

action.sqf <---- What im trying to populate the listbox with after the button is clicked.

case "test_base":
{
	_return = 
	[
		["Land_HBarrier_1_F",0],
		["Land_HBarrierBig_F",0],
		["Land_Razorwire_F",0],
		["Land_BarGate_F",0]
	];
}; 

Share this post


Link to post
Share on other sites

I have read up more on this and still have not figured this out yet. More detail of what I am trying to achieve here is when the button is clicked it will display items seen in action.sqf and then when another button is clicked it will clear the items under test_base and load more. Any ideas or examples that could help me out?

Share this post


Link to post
Share on other sites

So basically your button shuffles through a host of items and displays them in the listbox? If that's the case, use this to execute action.sqf:

action = "nul = [params] execVM 'action.sqf'";

Where params are your parameters (like test_base) you need for action.sqf to work. To actually display these items, take a look at lbAdd. The "action" parameter I showed you above just gets added to the button in dialog.hpp.

Share this post


Link to post
Share on other sites

It doesn't shuffle through them. I should have explained it a little better. Here is an example I have 2 buttons when I click on one button it will display test_base and if I click on button 2 it will clear the text that is in the listbox and display test_base2. I have messed around with lbadd to no success. Could you give me an example?

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  

×