I don't think it is me this time. I put a minimize button on the main window of my app. When I minimize with using that button and then restore, all my gadgets are gone. If I minimize and restore using the icon in the taskbar 3 times after the gadgets vanish, the window redraws properly and all the gadgets are back. I don't see this behavior if I minimize using normal conventions so it seems to be some issue related to the ShowWindow_(HWND0,#SW_MINIMIZE) command I'm using. Thought I would try a postmessage or sendmessage equivalent, either cannot figure out the right syntax or it's just not working. Very strange and really annoying. I even tried capturing the #WM_RESTORE so I could un-hide all the gadgets but they cannot be un-hidden. Probably just me. Anyone ever seen anything like that?
RASHAD wrote: Wed Oct 29, 2025 5:11 am
Hi
How about ShowWindow_()
Yes as I commented above, that is the exact command I was using. Just now I changed that to this and seems to be more stable:
ShowWindow_(HWND0,#SW_SHOWMINIMIZED) << instead of #SW_MINIMIZE
It still minimizes but not going wonky on restore as before. Hopefully this is the fix. Will update here in a day or two after more testing...
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
ShowWindow_(WindowID(?),#SW_RESTORE )
InvalidateRect_(WindowID(?),0,1)
OR
ShowWindow_(WindowID(?),#SW_RESTORE )
UpdateWindow_(WindowID(?))
OR
SendMessage_(WindowID(?),#WM_SYSCOMMAND,#SC_RESTORE,1)
PostMessage_(GadgetID(0), #WM_LBUTTONDOWN, 0, 0)
PostMessage_(GadgetID(0), #WM_LBUTTONUP, 0, 0)
I'm not using any code to restore the window. I'm just clicking the icon in the taskbar to do restore. Or using relaunch which tells the current process to restore and take foreground and then the new process terminates. I also tried catching the WM_RESTORE so I could tell it to InvalidateRect_ the window but had no affect.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
BarryG wrote: Wed Oct 29, 2025 8:47 am
Why are you using API calls instead of the SetWindowState() command?
Such a good question! Primarily because I didn't know that was an available option.
Now that I know and have tried it, my new command line to replace the API is:
SetWindowState(#Window_0,#PB_Window_Minimize)
That does indeed minimize the window. Now I just have to wait and see if that is going to make a difference. (Problem being intermittent as it is.) I also added code RASHAD suggested.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Case #WM_SYSCOMMAND
Select wParam
Case #SC_RESTORE
PostMessage_(WindowID(?), #WM_LBUTTONDOWN, 0, 0)
PostMessage_(WindowID(?), #WM_LBUTTONUP, 0, 0)
EndSelect
Not using Canvas Container but I did follow the above suggestion, Now just have to wait to see if any improvement. (Problem being intermittent as it is.) I also substituted code suggested by BarryG to replace the minimize API.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nope Afraid the issue still exists, so I'll just have to have my minimize button position the mouse over the Window titlebar minimize button and send left click, hoping for the best.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nope, even goingto that extreme had no affect. Window can still come up blank.
I did notice something though, I create the window invisible and hidewindow(#HWND0,0) after after launch when everything is loaded and initialized. The window shows blank for a few seconds while all that initialization is taking place, and then all the gadgets suddenly appear. So maybe hide unhide will be the solution? Hmmm.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
It's definitely some kind of event with redraw issue. You need to reproduce it with a small standalone version to find out. What does your main event loop look like? Can you show us? Make sure it doesn't have any unnecessary delays.