Jump to content
KutPax

Need help with an error

Recommended Posts

Heya,

I'm working on a GUI with a RscCombo box, only I'm getting an error.


This is my code:
 

_display displayAddEventhandler ["Unload", {
    params ["_display"];
    private _ctrlEdit13 = _display displayCtrl 6901;
    missionNamespace setVariable ["Snake_enteredText13", lbCurSel _ctrlEdit13, true];
}];

_ctrlEdit13 = _display displayCtrl 6901;
_ctrlEdit13 lbSetCurSel (missionNamespace getVariable ["Snake_enteredText13", ""]);

This is the error:

Error lbSetCurSel: Type String, expected number

 

If anyone knows a fix to this, please do let me know. I'd be very grateful!

Share this post


Link to post
Share on other sites

you are giving lbSetCurSel a string, but it needs a number. number meas which combobox item is selected

Share this post


Link to post
Share on other sites

The problem is I don't have a number. Any idea on how I can fix that?

Share this post


Link to post
Share on other sites
20 minutes ago, KutPax said:

The problem is I don't have a number. Any idea on how I can fix that?

So 0, default to the first thing in the combo.

Share this post


Link to post
Share on other sites
20 minutes ago, KutPax said:

The problem is I don't have a number. Any idea on how I can fix that?

 

see the getvariable default parameter here ("") :

 

_ctrlEdit13 lbSetCurSel (missionNamespace getVariable ["Snake_enteredText13", ""]);

change it to:

 

_ctrlEdit13 lbSetCurSel (missionNamespace getVariable ["Snake_enteredText13", 0]);

 

now zero is your default number

Share this post


Link to post
Share on other sites

Wow, I tried something like that, but didn't realise I put the 0 between "". Anyways, it worked1 Thanks my dude

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

×