2020-01-27 07:03 AM
Hello,
Imagine I've got an object, say a numpad, that I want to display or hide upon a specific button press.
What are the pros and cons of using one method vs the other? I'm especially asking in terms of performance as keeping the object added but hidden allows to do a partial redraw (object.invalidate()).
Should add/remove only be used when we wish to change the Z-order of the object?
Thanks in advance.
Solved! Go to Solution.
2020-03-31 08:20 AM
What is "one method" and what is "the other" here ?
If something is hidden, it's not drawn and does not incur any penalties. Showing hiding things is perfectly fine. I'm now guessing that you mean "what are the pros and cons of hiding vs REMOVING an element from the root container" ?
The only reason you'd remove something is to place it differently in the "tree" of widgets (z-order).
/Martin
2020-03-31 08:20 AM
What is "one method" and what is "the other" here ?
If something is hidden, it's not drawn and does not incur any penalties. Showing hiding things is perfectly fine. I'm now guessing that you mean "what are the pros and cons of hiding vs REMOVING an element from the root container" ?
The only reason you'd remove something is to place it differently in the "tree" of widgets (z-order).
/Martin