Jump to content
Sign in to follow this  
lawman_actual

Type Number, expected Control: error

Recommended Posts

I'm trying to set a checkbox as unchecked, but I get the error stating "type, number. Expected, control"

I've checked the control idc and it matches what i've typed in the script...so I don't know how to get that "number" recognised as an idc.

 

{_x ctrlSetChecked false;} forEach [2801,2802,2803];

 

I've also had a similar thing before where I was storing group names in an array, but was later unable to issue a command using that recalled group name because it was a "string" as opposed to a "group", even though tests showed that the group name matched the string exactly.

 

Thanks,

Law

Share this post


Link to post
Share on other sites

You probably need to get the display first:

 

{
   ((findDisplay IDD) displayCtrl_x) ctrlSetChecked false;
} forEach [2801,2802,2803];

 

or
 

 

disableSerialization;

private _display  = findDisplay IDD;

{
  (_display displayCtrl _x) ctrlSetChecked false;
} forEach [2801,2802,2803];

 

 

Share this post


Link to post
Share on other sites
10 hours ago, killzone_kid said:

Always check syntax https://community.bistudio.com/wiki/ctrlSetChecked

For example 2801 is Number while command wants Control

 

I think this is what i failed to grasp thus far.

 

As an example, I have used these in the same file and they seem to work fine...which I think led me to be confused between idc and control:

	ctrlSetText [1002,(format ["%1",_providerMunition])];		//Set Munition
	ctrlSetText [1004,(format ["%1",_providerSize])];		//Set Battery Size
	ctrlSetText [1007,(format ["%1",_providerMin])];		//Set Min Dist
	ctrlSetText [1008,(format ["%1",_providerMax])];		//Set Max Dist	
	ctrlSetText [1010,(format ["%1",_providerPos])];		//Set POS	

 

Now i see that in the syntax it asks for idc in the setText example, rather than control.

Anywho, I'll go back and try out the suggestion. Thanks

 

(Sub-note: massive thank you to KK for your GUI tutorials, among your other work. I'd have really struggled without it)

Share this post


Link to post
Share on other sites

Well i'm not getting an error anymore, but the desire outcome still isn't ocurring.

 

//If HE ranging selected:	
if (_IdcAsNumber == 2800) then 
								{
									hint "Marker check";
									((findDisplay 0002) displayCtrl 2801) ctrlSetChecked false;
									((findDisplay 0002) displayCtrl 2802) ctrlSetChecked false;
									((findDisplay 0002) displayCtrl 2803) ctrlSetChecked false;
									//{((findDisplay 0002) displayCtrl _x ) ctrlSetChecked false;} forEach [2801,2802,2803];									
								};

 

The aim is that only one of four boxes can be checked. So i figured when any one is checked, it can set the other 3 to unchecked.

However, when I run a test and check 2801, then 2800 - nothing happens. Both boxes remain checked even though the "Marker check" correctly trips.

 

I've tried both with and without the foreach

Share this post


Link to post
Share on other sites

Apologies; probably should have given that a bit longer before asking.

Once i remembered there was also cbSetChecked it worked.

 

Thanks for your help guys

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  

×