Skip to main content
nkash.5
Associate
December 23, 2022
Question

Why are all event callback parameters declared "const"? how do I alter UI from events?

  • December 23, 2022
  • 3 replies
  • 1047 views

For instance "void textAreaClickHandler(const TextAreaWithOneWildcard& area, const ClickEvent& event);"

I would like to alter UI controls from callbacks but "const" seem to tell me that that's against some big picture idea of TGFX? What concept am I missing? I've looked at documentation and did not see anything very focused on event paradigm.

This topic has been closed for replies.

3 replies

MM..1
Super User
December 23, 2022

Simply this & is addr to objects and need protect to overwrite. But you can call methods for change this objects properties free...

nkash.5
nkash.5Author
Associate
December 23, 2022

C:/Work/T4sest/est1/TouchGFX/gui/src/screen1_screen/Screen1View.cpp:60:21: error: passing 'const touchgfx::TextAreaWithOneWildcard' as 'this' argument discards qualifiers [-fpermissive]

  60 |     b.setAlpha(1);

MM..1
Super User
December 23, 2022

Show code

...