2025-06-30 4:44 AM
Hi.
We have an application with a touch screen and 4 physical buttons. We have designed a demonstration GIU in TouchGFX, but to allow the simulator to handle presses on the hardware buttons, we have added the hardware buttons on the display. Consequently the display is made 100 pixels higher to have room for the buttons. It works fine for the simulator, but we cannot use the GUI design as it is for building the target application.
I expected that it was possible to setup the simulator to hold the hardware buttons as an addition the the application display. But apparently not.
It would be nice if it was possible to design the hardware button arrangement in addition the the GUI. The buttons should of cause have a legend and the button ID in addition to the arrangement. And of cause this should not be included in the target build. But it would be nice if it could hold additional fields (e.g. text areas and radio buttons) for simulating the rest of the hardware
Did I miss something?
Regards
Kasper.
Solved! Go to Solution.
2025-06-30 5:39 AM
Hello @Leonhardt,
It's already possible to do so, when you create an interaction, with hardware button click you have a number and a character next to it :
The character next to it is the keyboard character that will simulate the button.
In the case of the image, the hardware button id will be 65 which is also the ascii char A, so in the sim clicking on A will simulate the behaviour of the hw button.
I hope it answers your question,
BR,
2025-06-30 5:39 AM
Hello @Leonhardt,
It's already possible to do so, when you create an interaction, with hardware button click you have a number and a character next to it :
The character next to it is the keyboard character that will simulate the button.
In the case of the image, the hardware button id will be 65 which is also the ascii char A, so in the sim clicking on A will simulate the behaviour of the hw button.
I hope it answers your question,
BR,
2025-06-30 6:01 AM - edited 2025-07-02 3:39 AM
You can create a skin with buttons on it. Those are not clickable. But you could modify the code so that those are clickable.
You could modify the code so you create a second window with just buttons.
Below an example of a skin and code to use external buttons on skin + keyboard keys
HALSDL2.cpp:
uint8_t HALSDL2::keyPressed = 0;
bool key[3];
bool key_old[3];
bool HALSDL2::doSampleTouch(int32_t& x, int32_t& y) const
{
x = _x - getCurrentSkinX();
y = _y - getCurrentSkinY();
if (DISPLAY_ROTATION == rotate90)
{
int32_t tmp = x;
x = y;
y = DISPLAY_WIDTH - tmp;
}
bool touched = popTouch();
if (touched)
{
if (isSkinActive && currentSkin != 0 && currentSkin->surface != 0)
{
if (_x >= 100 && _x < 100 + 150 && _y >= 30 && _y < 30 + 40)
{
key[0] = true;
key[1] = false;
key[2] = false;
}
else if (_x >= 300 && _x < 300 + 150 && _y >= 30 && _y < 30 + 40)
{
key[0] = false;
key[1] = true;
key[2] = false;
}
else if (_x >= 500 && _x < 500 + 150 && _y >= 30 && _y < 30 + 40)
{
key[0] = false;
key[1] = false;
key[2] = true;
}
else
{
key[0] = false;
key[1] = false;
key[2] = false;
}
}
else
{
key[0] = false;
key[1] = false;
key[2] = false;
}
}
else
{
key[0] = false;
key[1] = false;
key[2] = false;
}
// modify on rising edge
if (key[0] && !key_old[0])
{
keyPressed = '1';
}
else if (key[1] && !key_old[1])
{
keyPressed = '2';
}
if (key[2] && !key_old[2])
{
keyPressed = '3';
}
key_old[0] = key[0];
key_old[1] = key[1];
key_old[2] = key[2];
return touched;
}
bool HALSDL2::sampleKey(uint8_t& key)
{
if (keyPressed)
{
key = keyPressed;
keyPressed = 0;
return true;
}
return false;
}