I have a window with 2 generic text buttons at the exact same position with the exact same size. One is initially visible the other is not. Depending on the App state the visible button will be hidden (visible = false) the hidden one will be shown (visible = true).
Problem: The visible one will be set hidden but the hidden one will not be set visible. So it looks like as there is no button. If I move initially set the hidden button to another position it will show up (to make sure the visibility handling is working).
Any clues how to male 2 generic buttons at the same position with same size and visible/hidden handling will work?
Type: Desktop App
Tested on Windows 10 and Mac (Catalina)
SHould be working
if it remains a mystery, use movement and enabling instead?
if condition then
button1.top = -2000
button1.enabled = false
button2.top = 300 //or whatever
button2.enabled = true
button1.top = 300 //or whatever
button1.enabled = true
button2.top = -2000
button2.enabled = false
Could it be that the 2nd button has become a child of the 1st button within the IDE (clicking the second button in the IDE will show a red ring if it is a child).
When I need to do this I usually position buttons in different places on the window and then move them using code.
@Jeff Tullin : Will do so, take it as the right answer (workaround)
@Kevin Gale : Good point, checked, no it isn’t. I guess it’s a displaying hierarchy problem.
You can still do hiding, but the notion of having them in other, non-overlapping, places when looking at them in the IDE is a good one. Have an open event for each button to move them to where you want them to be.
Use one button and just change the caption
Then when its pressed see what the coption is and do the right thing based on that
No muss no fuss and no need to be moving buttons etc around
Have you thought about using a pagepanel and just toggling the visible page based on the condition?