2024-02-19 11:37 PM
I build a custom Numpad Container. Iam setting it Visible when a textarea is clicked. And it is the top layer on the Screen. Trying to set other containers on a lower layer not touchable is not working.
I can still click the slide menu button und some other buttons on my Background container.
Is it a bug?
scrollableContainer.setTouchable(false);
slideMenuContainer.setTouchable(false);
backGroundContainer.setTouchable(false);
Solved! Go to Solution.
2024-02-20 07:51 AM - edited 2024-02-20 08:02 AM
Hello
Easy way to make your keypad 'modal' is first make keypad container size to match your screen size and move the actual keypad to the center of the screen, for example.
Then place normal box- widget to your keypad- container and match the size of it so that it equals your screen size. Put last in the list, i mean, behind the the other widgets of keypad.
Then put mixins - clickListener selected from that keypad background box.Then this box 'eats' all clicks which are not pointed to keypad area.
You can also set alpha value of it so that its fully transparent. Or make it partially transparent to get your keypad popup since other parts of ui are dimmed.
Then its enough just to set keypad visible true, not needed to work with touchable- property of other containers on the screen.
BR JTP
2024-02-19 11:39 PM
have you also called scrollableContainer.invalidate(); after each one? you need to invalidate everytime you change something in any object/widget.
Greetings.
2024-02-20 04:10 AM
I also tried this yes, but it didnt help.
2024-02-20 04:14 AM
Inside each container, there are something you dont want to "touch" when your numpad is visible, have you tried to set not touchable what is inside those containers, instead of whole container?
2024-02-20 04:33 AM
Yes, if the user will click on a textarea the numpad container will popup on the top layer.
When the user confirmed the numpad input, the input will be copied to the testArea. This works fine.
Mz goal is to block all other inputs on the display. In the back there is a background container with a button to switch the language, set the time and some other buttons. I tried to block these buttons with the function setTouchable(false) and invalidate();. But this worked not for all the buttons in the background container. So i tried to block the touch input for the container.
2024-02-20 04:38 AM
If it is possible for you, share the code you are using to enabling and disabling the touchpad on the components/widgets. Seems for me some kind of logic issue when Disabling and Enabling the touchable.
Maybe in your "HandleTickEvent" or in you "setupscreen" or whatever function you are enabling the touchPad, you are enabling again something before the showingup the touchPad.
2024-02-20 04:44 AM
I have two Callbacks. One from the textArea and one from the numpad Container.
void SettingsView::valueContainer_ClickHandler(ValueContainer *valueContainer)
{
numPadContainer.setVisible(true);
numPadContainer.invalidate();
scrollableContainer.setTouchable(false);
scrollableContainer.invalidate();
slideMenuContainer.setTouchable(false);
slideMenuContainer.invalidate();
backGroundContainer.setTouchable(false);
backGroundContainer.invalidate();
valueContainer_Ptr = valueContainer;
this->invalidate();
}
void SettingsView::numPadContainer_ClickHandler(double *numPadInput)
{
if(numPadInput != NULL)
{
valueContainer_Ptr->setTextArea_Value(*numPadInput);
#ifndef SIMULATOR
uint16_t msgIndex = valueContainer_Ptr->get_MessageIndex();
Msg_ValueStruct_t MsgFromGui = { .index = msgIndex, .eventType = EVENT_VALUE_SET, .value = *numPadInput };
presenter->set_Value(MsgFromGui);
#endif
}
numPadContainer.setVisible(false);
numPadContainer.invalidate();
scrollableContainer.setTouchable(true);
scrollableContainer.invalidate();
slideMenuContainer.setTouchable(true);
slideMenuContainer.invalidate();
backGroundContainer.setTouchable(true);
backGroundContainer.invalidate();
this->invalidate();
}
2024-02-20 04:52 AM
If i am not wrong, this numPadContainer_ClickHandler would happen whenever you click any button from the numPad, so, in the moment 0 before you click any button, all of your other containers are not touchable, but once you do your first touch in the container, they go back as touchable and also the numPad itself would not be even vissible.
Is this the intended behaivour?
Else you can add another condition in the numPad handler, waiting for a certain button to be clicked before putting everything as touchable again?
2024-02-20 05:01 AM - edited 2024-02-20 05:01 AM
I only run the callback function if the user hits ok or cancel.
I just debugged it.
void NumPadContainer::function_NumPad_Cancel(void)
{
if (viewCallback && viewCallback->isValid())
{
numPadInput = 0;
viewCallback->execute(&numPadInput);
}
Unicode::UnicodeChar del[] = { 0x00 };
Unicode::strncpy(&textAreaNumPadBuffer[0], del, TEXTAREANUMPAD_SIZE);
textAreaNumPad.invalidate();
}
void NumPadContainer::function_NumPad_Ok(void)
{
if (viewCallback && viewCallback->isValid())
{
Unicode::toUTF8(textAreaNumPadBuffer, utf8_Buffer, BUFFER_SIZE);
numPadInput = std::atof((const char *)utf8_Buffer);
viewCallback->execute(&numPadInput);
}
Unicode::UnicodeChar del[] = { 0x00 };
Unicode::strncpy(&textAreaNumPadBuffer[0], del, TEXTAREANUMPAD_SIZE);
textAreaNumPad.invalidate();
}
2024-02-20 07:51 AM - edited 2024-02-20 08:02 AM
Hello
Easy way to make your keypad 'modal' is first make keypad container size to match your screen size and move the actual keypad to the center of the screen, for example.
Then place normal box- widget to your keypad- container and match the size of it so that it equals your screen size. Put last in the list, i mean, behind the the other widgets of keypad.
Then put mixins - clickListener selected from that keypad background box.Then this box 'eats' all clicks which are not pointed to keypad area.
You can also set alpha value of it so that its fully transparent. Or make it partially transparent to get your keypad popup since other parts of ui are dimmed.
Then its enough just to set keypad visible true, not needed to work with touchable- property of other containers on the screen.
BR JTP