Setting RadioButton state without triggering action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-17 9:11 AM
Hi,
I have 3 radio-buttons in a custom container which is present on several screens.
I would like the radio-buttons to keep their states between when switching screens.
I have the radio-buttons states reported to the model every time a button is pressed and when the screen changes, the new active view fetches the radio-button state.
However, I do not see a function to update a radio-button state without triggering the button action.
Is there such a function?
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-18 7:12 AM
Why you define callbacks in base code, when i create screen with radio my code is
/*********************************************************************************/
/********** THIS FILE IS GENERATED BY TOUCHGFX DESIGNER, DO NOT MODIFY ***********/
/*********************************************************************************/
#include <gui_generated/screen1_screen/Screen1ViewBase.hpp>
#include <touchgfx/Color.hpp>
#include "BitmapDatabase.hpp"
Screen1ViewBase::Screen1ViewBase()
{
__background.setPosition(0, 0, 800, 480);
__background.setColor(touchgfx::Color::getColorFrom24BitRGB(0, 0, 0));
toggleButton1.setXY(336, 193);
toggleButton1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_TOGGLEBARS_TOGGLE_ROUND_LARGE_BUTTON_OFF_ID), touchgfx::Bitmap(BITMAP_BLUE_TOGGLEBARS_TOGGLE_ROUND_LARGE_BUTTON_ON_ID));
radioButton1.setXY(356, 43);
radioButton1.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_INACTIVE_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_PRESSED_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_ACTIVE_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_NORMAL_ID));
radioButton1.setSelected(false);
radioButton1.setDeselectionEnabled(false);
radioButton2.setXY(356, 104);
radioButton2.setBitmaps(touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_INACTIVE_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_PRESSED_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_ACTIVE_ID), touchgfx::Bitmap(BITMAP_BLUE_CHECK_BUTTONS_CHECK_MARK_NORMAL_ID));
radioButton2.setSelected(true);
radioButton2.setDeselectionEnabled(false);
add(__background);
add(toggleButton1);
add(radioButton1);
add(radioButton2);
radioButtonGroup1.add(radioButton1);
radioButtonGroup1.add(radioButton2);
}
void Screen1ViewBase::setupScreen()
{
}
no callbacks here...
place this in view setup code after change selected states
radioButtonGroup.setRadioButtonSelectedHandler(radioButtonSelectedCallback);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-18 7:29 AM
The callback defined in the base file has been generated using TouchGFX designer.
The code I have added is in the MainView.cpp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-02-18 7:33 AM
As i write when you plan change state against designer states, without call callback, then you can dont generate callbacks to base file, and do it yourself in setup code ...
maybe too is possible redefine callback to null , set new group state and reaply original callback, but this i dont try.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-10 6:18 AM - edited ‎2025-02-10 6:19 AM
Hi all,
I have the same problem (I'm using 4.24.0 version):
I have a lot of screens with radiobutton, And at at startup I need to change the selections due to user configuration.
But everytime I call "setSelected" the relative action is called and this trigger wrong behaviour on my code
I suggest in the next touchgfx release to insert a method similar to "forcestate" to upgrade the radiobutton state without generate action.
I would like to avoid to delete the callback in realtime and after change the status re-enabled them.

- « Previous
-
- 1
- 2
- Next »