Jump to content
Sign in to follow this  
minipopov

Create button with command ctrlCreate

Recommended Posts

Hello,

 

I would create an image button with command ctrlCreate. Is anyone know how to do it? I try create one with RscButtonImages but it s not working. Many warning on my screen and i ask to support and they told me that:

 

 

Hello,

RscButtonImages is not a control so you cannot create it using ctrlCreate.

I have discussed this with the devs and it seems that it is incorrectly sorted into the RscXxxxxxxxxx, the structure of it however gives away it is not a control.

 

 

So what's the solution? What's the difference between button and image with event onclick?

Share this post


Link to post
Share on other sites


openMap true;

_ctrl = findDisplay 12 ctrlCreate ["RscButton", -1];

_ctrl ctrlSetPosition [0.35,0.45,0.3,0.1];

_ctrl ctrlCommit 0;

_ctrl ctrlSetText "PUSH ME!";

_ctrl ctrlAddEventHandler ["ButtonClick", {hint "Hurray!!! You pushed me!!!"}];

Share this post


Link to post
Share on other sites

Yes, this is for button TEXT, i would create button IMAGE

Share this post


Link to post
Share on other sites

minipopov, the best way I've found to do this is to create an image with an event handler:

_ctrl = (_display ctrlCreate ["RscActivePictureKeepAspect", _ctrl_idd]);
_ctrl ctrlSetText "some_image.paa";
_ctrl ctrlAddEventHandler ["MouseButtonUp", "_this call FooBar"];

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  

×