Window is not repainted.
Window is not repainted.
Use "Image.pb" as an example.  If I have two windows, one is "Image" and another is any window which overlaps "Image". First, make "Image" on the top, then click 2nd window in the task bar so that it overlaps "Image", and then click 2nd window in the task bar again to minimize it.
Now you will find "Image" is not repainted, i.e. it doesn't receive #WM_PAINT message. So, what is the correct way to repaint window if I don't use a ImageGadget?
I just found it depends on what the 2nd windows is. Sometime it get repainted, sometimes not. In my case, if 2nd window is IE, then it is not repainted.
			
			
									
									
						Now you will find "Image" is not repainted, i.e. it doesn't receive #WM_PAINT message. So, what is the correct way to repaint window if I don't use a ImageGadget?
I just found it depends on what the 2nd windows is. Sometime it get repainted, sometimes not. In my case, if 2nd window is IE, then it is not repainted.
You are right.
On my box, if I click the task bar and open another (any) window maximised, and then minimise it again, there is no repaint.
But if I open a non-maximised window to overlap or fully cover (or move a window across) there is repaint.
If I click the example in the taskbar to get it back on top, it redraws. But not if it is already on top.
(Just re-inforcing your statement, I have no idea why this is so.)
BTW, using an image gadget is simpler and surer and AFAIK has no real detrimental effect.
			
			
									
									On my box, if I click the task bar and open another (any) window maximised, and then minimise it again, there is no repaint.
But if I open a non-maximised window to overlap or fully cover (or move a window across) there is repaint.
If I click the example in the taskbar to get it back on top, it redraws. But not if it is already on top.
(Just re-inforcing your statement, I have no idea why this is so.)
BTW, using an image gadget is simpler and surer and AFAIK has no real detrimental effect.
@}--`--,--  A rose by any other name ..
						- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
Any time you do 2d drawing directly to a window you have to add a tiny step to your main loop:
With this step added to your loop your drawing will get repainted every time the gadgets do.
			
			
									
									Code: Select all
Procedure DrawStuff()
  ;here do your non-gadget drawing
Endprocedure
Repeat
  EventID = WaitWindowEvent()
  Select EventID
     Case #WM_PAINT
         DrawStuff()
      Case #Anothermessage
         ;handle that one
  EndSelect
Until EventID = #PB_Event_CloseWindow
BERESHEIT
						- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
Run this code:netmaestro wrote:I can't reproduce it. I ran Image.pb that comes with b11 and put all manner of windows, maximized and otherwise, covering it partially and fully and it won't give problems. @Dare2, have you upgraded from Windows 3.1 yet?
Code: Select all
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
Repeat
  Select WaitWindowEvent()
    Case #PB_Event_Repaint
      StartDrawing(WindowOutput(0))
        Circle(100, 100, 100, 100)
      StopDrawing()
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
Yep, wierd. But there it is.
Simple test that fails for me:
Load image.pb into the IDE, which is opened and maximised.
Run it (with or without debug).
Click the taskbar to bring the IDE to the fore.
Click again to minimise.
Window is blank and stays that way.
Close
Simple test that works for me:
Load image.pb into the IDE, which is opened and maximised.
Run it (with or without debug).
Click the taskbar to bring the IDE to the fore.
Click the taskbar to bring the image.pb window to the fore.
Window is painted nicely
Close
			
			
									
									Simple test that fails for me:
Load image.pb into the IDE, which is opened and maximised.
Run it (with or without debug).
Click the taskbar to bring the IDE to the fore.
Click again to minimise.
Window is blank and stays that way.
Close
Simple test that works for me:
Load image.pb into the IDE, which is opened and maximised.
Run it (with or without debug).
Click the taskbar to bring the IDE to the fore.
Click the taskbar to bring the image.pb window to the fore.
Window is painted nicely
Close
@}--`--,--  A rose by any other name ..
						.. however, add this code:
right after
And the problem goes away. So here it is callback isn't getting called.
Edit:
I am no windows guru, but if that isn't PB then it suggests that all apps that survive a maximise/minimise event are using the #WM_PAINT check in their main window processing loop and don't rely on callbacks for that one case.
Edit again:
I just realised what I said. Fortunately I have already dissed myself as a windows guru.
			
			
									
									Code: Select all
    If EventID =#WM_PAINT
      StartDrawing(WindowOutput(0))
        DrawImage(ImageID(0), 20, 10)
        DrawImage(ImageID(1), 320, 80)
        DrawImage(ImageID(2), 320, 200)
      StopDrawing()
    EndIfCode: Select all
EventID = WaitWindowEvent()Edit:
I am no windows guru, but if that isn't PB then it suggests that all apps that survive a maximise/minimise event are using the #WM_PAINT check in their main window processing loop and don't rely on callbacks for that one case.
Edit again:
I just realised what I said. Fortunately I have already dissed myself as a windows guru.
@}--`--,--  A rose by any other name ..
						- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 
netmaestro wrote:I even got a cpu-usage compliment from psychopanta and that's not easy to get!
True!
An impressive compliment and quite a feather in your cap. (I'm not kidding either)
tricky or trond or you can post a bug - I don't like posting there unless I have to (that is, if, after several decades, nobody else appears to have posted the bug or discussed it).
edit:
Begger! Where did the rest of your post go!
@}--`--,--  A rose by any other name ..
						- netmaestro
 - PureBasic Bullfrog

 - Posts: 8452
 - Joined: Wed Jul 06, 2005 5:42 am
 - Location: Fort Nelson, BC, Canada
 

