Jump to content
Sign in to follow this  
Melmarkian

ctrlactivate or how to activate a button/activeText per script

Recommended Posts

Hi,

I am nearly done with a crate designer dialog but there is one thing that I doesn´t like:

Short Version:

Is ctrlactivate used to set a button/activetext to active? Because I try to use it and nothing happens. The control I use for activating is the correct one because I hint it a the same place where it should be used as argument for the ctrlactivate.

Long Version:

There is a bar

fillerbar.jpg

When you click on a weapon on the left side, the right column updates and shows the chosen weapon + mags + grenades. You click on one item and your crate is filled with it.

And here it comes:

The Dialog has to be recreated at this point to show the current content of the crate. In this process the right column is again set to empty so you have to choose a weapon again. But I want it to remember the last entry.

I have a script which picks the control of the chosen left column entry and uses it to ctrlactivate when the dialog is redone. I can hint the control and it actually shows the correct one but the button isn´t set to active.

Edited by Melmarkian

Share this post


Link to post
Share on other sites

I think you misunderstood what ctrlActivate does. It only de-/activates a control. A deactivated control stays visible but can't be used / clicked on.

If I understand you correct, you are trying to preform the action assigned to your control.(?) Not 100% sure but it might work with buttonAction:

_action = buttonAction _control;
call _action;

However, wouldn't it be easier to use ctrlSetText for the control(s) you want to update, instead of closing and re-opening the complete dialog?

Share this post


Link to post
Share on other sites

I thought ctrlEnable is the command to activate/deactivate a control and buttonaction would return the action attached to the control?

I will test a bit with the CtrlSetText command. Thank you!

Share this post


Link to post
Share on other sites
I thought ctrlEnable is the command to activate/deactivate a control

Yes, you are of course absolutely right. Must have mixed things up. Sorry for that. :blush:

Just tried it myself and I couldn't get ctrlActivate to do anything, neither with passed idc or the actual control. Also tried both active text and button controls, but no luck so far. No idea what's going wrong there.

However, I did get the buttonAction part working:

call compile (buttonAction _idc);

This will execute whatever action is assigned to that control.

Hope this helps you. :)

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  

×