My Delphi application initially starts by showing the main form, but with a user login panel only. I hide the main menu, so that the unauthenticated user is not able to access it. Upon user login, I dynamically assign the menu by setting Form.Menu := MyMainMenu;
.
However, when the user logs in, and I assign the main menu as mentioned, it isn't immediately visible until the form is resized in some way. Minimizing the window and showing it again also triggers the main menu to show. However, I need it to show right away when I assign it.
I have tried adding the following attempts just after assigning the main menu, but makes no difference:
Self.Repaint;
Self.Refresh;
Application.ProcessMessages;
The only thing I can do is to slightly resize the form in run-time, then it triggers it to show. However, not only is this sloppy, but my application shows in the Maximized state by default.
Note: I am using VCL Styles. Without styles, it shows just fine. Trying Vcl-Styles-Utils
and its fixes does not make a difference.
How do I get the newly assigned main menu to immediately show without a "resize" hack?
On a side note, when I close the application, I have a memory leak:
Without VCL Styles, this memory leak doesn't occur. Not that I'm asking for a solution for that, but an additional symptom which might help identify the root issue.