I'm fighting from longtime with hiding/showing controls and refreshing/realigning the app window. I think i'm missing something important, and i would like to finally learn to handle these kind of behaviour.
The attached .cpp files shows a portion of a very complex "kiosk" app. It should compile alone and should look like this (screenshot taken on Win10, but the problem exists on Debian also):
When clicking on one of the menu, a panel should appear at the bottom of the window, but instead you nothing (if not that tiny part of a button in the corner)
... continuing on the next post as i can't attach more image.
Cannot refresh the window when Show/Hide a panel
Cannot refresh the window when Show/Hide a panel
- Attachments
-
- TestDebug_HidePanels.cpp
- (20.79 KiB) Downloaded 98 times
Last edited by Parduz on Wed Feb 01, 2023 4:09 pm, edited 1 time in total.
Re: Cannot refresh the window when Show/Hide a panel
The bottom panel becomes visible only if i resize the window (a thing that i cannot do even with code in the deployement field as the form is borderless and maximized)
On the very bottom of the source file there's all i've tried to fix it without any result.
What should i do?
When clicking again on the menu items the panel should get hidden again, but this is what i got (unless i resize again)
On the very bottom of the source file there's all i've tried to fix it without any result.
What should i do?
Re: Cannot refresh the window when Show/Hide a panel
Usually when resizing the outer frame fixes the layout, just a Layout() call on the topmost sizer will do the trick.
But as you're already doing it, there must be something else going on.
You could try calling SendSizeEvent() on the outer frame.
Otherwise, I'm not going to debug 200 lines of pure sizer code. Please strip it down to the absolute minimum to reproduce the issue.
General advice: A sizer that only contains one element usually doesn't make any sense. And i see quite a few of those.
But as you're already doing it, there must be something else going on.
You could try calling SendSizeEvent() on the outer frame.
Otherwise, I'm not going to debug 200 lines of pure sizer code. Please strip it down to the absolute minimum to reproduce the issue.
General advice: A sizer that only contains one element usually doesn't make any sense. And i see quite a few of those.
Use the source, Luke!
Re: Cannot refresh the window when Show/Hide a panel
Ok, i'll try ASAP.
Now, this is a bit hard, not 'cause i don't want but 'cause i don't know how to do it.
The full story is that i make my app UI using wxCrafter, and what's in the code i posted here is just the single .... "branch" relevant to the problem. I mean: i've removed everything else that was not parent/sibling of the panel that has to be hidden (i'm talking about a dozen of pages and a tenth of sub-pages of equal complexity).
(this is my whole app: the page 03/sub bitmap is the only branch i've put in the code attached)
The fun (or tragic) part is that this code was planned to be the WORKING sample, because in my app this works! The show/hide panel ceased to work when i changed all the "topmost" labels and textboxes with the wxstyledtextcontrol we already talked about in one of my recent threads.
I was preparing 2 code samples, basically identical apart for that controls, and asking why one works and the other one not. I was not expecting to have the problem appearing with THIS code.
Which gives me the idea that whatever i touch/change can make it works without really knowing what was the real problem (and this is exactly why i'm fighting with this kind of problems from longtime: sometime things just starts working and i can't track down what of the many unrelated changes in the UI i've made "solved" it, sometime a bunch of "layout" calls solves it. My impression is that i "mask", or "patch" the real problem, not "understanding and solving" it).
Usually i do this 'cause alignement: wxStaticText can be centered on the containers only using a sizer... AFAIK. Am i wrong?