Jump to content
POLPOX

Adding Event Handler to a control that created via ctrlCreate?

Recommended Posts

I found ctrlCreate, then test some but ctrlAdd/SetEventHandler did nothing.

Can we add Event Handler to a ctrlCreate'd control? Is it possible or impossible?

disableSerialization ;
_disp = findDisplay 46 createDisplay "RscDisplayEmpty" ;

_slider1 = _disp ctrlCreate ["RscXSliderH",10001] ;
_slider1 ctrlSetPosition [0,0.9,0.5,0.03] ;
_slider1 ctrlSetEventHandler ["OnSliderPosChanged","hintsilent str _this"] ;
...

 

Share this post


Link to post
Share on other sites
26 minutes ago, Grumpy Old Man said:

Did you try findDisplay 46 displayctrl _slider1 ctrlSetEventhandler?

Sorry, I just found how to do it.

_slider1 ctrlAddEventHandler ["SliderPosChanged","hintsilent str _this"] ;
_slider1 ctrlSetEventHandler ["SliderPosChanged","hintsilent str _this"] ;

It works.

Share this post


Link to post
Share on other sites

Yeah, you should drop "On", used only in configs, dunno why 

OnSliderPosChanged

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

×