cancel
Showing results for 
Search instead for 
Did you mean: 

Flex Button swap trigger from toggle to click from user code

MPast.1
Senior II

Hi All,

is it possibile to change a FlexButton Trigegr from code?

I would like to change from toggle to click and viceversa.

Has someone some hints?

thank's in advance

4 REPLIES 4
Alexandre RENOUX
Principal

Hello MPast.1,

One idea would be to create your own button widget. Note that this means you will not be able to see it in the Designer.

In the end you would declare your flexButton in your View header file like something as follows

touchgfx::ImageButtonStyle< touchgfx::CustomButtonTrigger > myFlexButton;

You create this CustomButtonTrigger class that will behave like ToggleButtonTrigger or ClickButtonTrigger according to some input. (Your class will inherit AbstractButtonContainer like in the ToggleButtonTrigger and ClickButtonTrigger class).

Or you can completely recreate a Button based on the Button classes to have all the features you want in a single class. Your choice 😉

/Alexandre

Hi Alexander,

thank you for the suggestion : , as soon as possibile I will try this mode.

Sometimes is necessary to change by code the trigger mode of a button (or other object).

I will be useful if the new release contain this mode. Can you evaluate to insert this mode in the next revision?

thanks

Hi,

Could you add this idea in the Idea Zone of this forum ? This will help us keep track of this. This will unlikely be added to the next release, but we never know for the next one 😉.

I can add that another work around would be to have two buttons (same position, looks, ...) and you switch to the one with the trigger you need when needed.

/Romain

In effec,t at moment I use this easy/fake solution .

But I would like to try your first solution