Jump to content
Sign in to follow this  
dragon zen

Problem with "lbAdd" code, can't use it...

Recommended Posts

Hello brothers:

I want to use Combo and I found it seems that I can't use lbAdd.

First, in my description.ext, I have prepared the #define, and set up a RscCombo as a model, and then create ComboTry.

class RscCombo {

type = CT_COMBO;

style = ST_LEFT;

font = "TahomaB";

color[] = {1,1,1,1};

colorText[] = {0,0,0,1};

colorBackground[] = {1,1,1,1};

colorSelect[] = {1,0,0,1};

colorSelectBackground[] = {0,1,0,1};

colorScrollbar[] = {0.023529, 0, 0.0313725, 1};

arrowEmpty = "\ca\ui\data\ui_arrow_combo_ca.paa";

arrowFull = "\ca\ui\data\ui_arrow_combo_active_ca.paa";

colorActive[] = {0, 0, 0, 1};

colorDisabled[] = {0, 0, 0, 0.3};

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

soundExpand[] = {"", 0.0, 1};

soundCollapse[] = {"", 0.0, 1};

maxHistoryDelay = 1.0;

class ScrollBar {

color[] = {1, 1, 1, 0.6};

colorActive[] = {1, 1, 1, 1};

colorDisabled[] = {1, 1, 1, 0.3};

thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa";

arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa";

arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa";

border = "\ca\ui\data\ui_border_scroll_ca.paa";

};

};

class FirstCombo {

idd=-1;

movingEnable=true;

enableSimulation=true;

controlBackground[]={};

objects[]={};

controls[]={ComboTry,Do,cancle};

class ComboTry : RscCombo {

idc = 821;

x = 0.1;y = 0.1;

w = 0.3;h = 0.3;

sizeEx = 0.35;

rowHeight = 0.35;

wholeHeight = 4 * 0.35;};

class ComboDo : ......

......

};

Before create dialog FirstCombo, I run "lblb.sqf" below.

_index1 = lbAdd [821, "First item"];

_index2 = lbAdd [821, "Second item"];

_index3 = lbAdd [821, "Third item"];

lbSetValue [821, 0, 1];

lbSetValue [821, 1, 2];

lbSetValue [821, 2, 3];

hint format["lbValue is %1",(lbValue [821,2])];

exit;

However, when I run lblb.sqf. The hint said "lbValue is 0", not 3. :eek:

I don't know why. It seems that idc 821 didn't response to the lblb.sqf?? lbAdd failed??

What's more, if I call the dialog, there is only a huge arrow, no row, no content. I think it is because idc 821 is empty.

Thanks for your help.:butbut:

Share this post


Link to post
Share on other sites

Before create dialog FirstCombo, I run "lblb.sqf" below.

There is your problem. Dialog has to be displayed for the controls to exist.

Share this post


Link to post
Share on other sites
There is your problem. Dialog has to be displayed for the controls to exist.

Sorry I still don't know what your mean. What should I do??

821 is in the description.ext and ext has already run when game start. And I run lblb.sqf during the game. What's wrong??

:confused:

---------- Post added at 11:39 PM ---------- Previous post was at 11:39 PM ----------

Is there any code or any where to "create idc" or "create control"??

Share this post


Link to post
Share on other sites
createDialog "FirstCombo"; //Show the dialog first
waitUntil {dialog}; //Wait for it to show

//Do stuff...
_index1 = lbAdd [821, "First item"];
_index2 = lbAdd [821, "Second item"];
_index3 = lbAdd [821, "Third item"];
lbSetValue [821, 0, 1];
lbSetValue [821, 1, 2];
lbSetValue [821, 2, 3];
hint format["lbValue is %1",(lbValue [821,2])];

Share this post


Link to post
Share on other sites
createDialog "FirstCombo"; //Show the dialog first
waitUntil {dialog}; //Wait for it to show

//Do stuff...
_index1 = lbAdd [821, "First item"];
_index2 = lbAdd [821, "Second item"];
_index3 = lbAdd [821, "Third item"];
lbSetValue [821, 0, 1];
lbSetValue [821, 1, 2];
lbSetValue [821, 2, 3];
hint format["lbValue is %1",(lbValue [821,2])];

Ha, OK, thanks for your help, I will try this.

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  

×