What does SetPanelPixmap do ( and *when* ) ?

BlitzMax Forums/MaxGUI Module/What does SetPanelPixmap do ( and *when* ) ?

Gabriel(Posted 2006) [#1]
I'm using SetPanelPixmap to put a pixmap on my window-filling panel. I want to write text over it, so I use TextOut in GDI32, because labels have ugly backgrounds I can't rid of and TextOut doesn't. Problem is, some of the text is shown and some isn't. If I let the window lose focus and regain ( which is when I redraw all the GDI stuff ) all the text is shown. So evidently SetPanelPixmap causes the image to be drawn at times other than when an EVENT_APPRESUME is thrown. I need to know what other times it will redraw the image so that I can redraw the text.

I tried doing it with GDI, but I'm not having any luck getting the image to show. I assume that SetPanelPixmap is using GDI32 under the hood anyway, I just need to know when it does it's thing so that I can do mine immediately after.

EDIT: I've added calls to the GDI drawing stuff on EVENT_APPSUSPEND, *all* EVENT_WINDOWACTIVATE instances and *all* EVENT_GADGETPAINT instances too, but it's still only drawing some, not all. Geez, there's not much left.

EDIT2: Ok, I've got it *kinda* pinned down but not sure what to do about it. I have a second window on top of the first one. When I hide the top window, I give focus back to the lower window. Whatever was underneath the upper window is not redrawn, even though the Redraw function is called as soon because I have the focus change event set to trigger it automatically. Now I'm stuck knowing how to fix that. Exactly when is BMax redrawing the panelpixmap and how do I detect that and redraw my stuff on top?


impixi(Posted 2006) [#2]
I've been experiencing 'redraw' issues with panel pixmaps too. The only workaround I could find involves hiding the panel then showing it again immediately - this effectively forces a redraw. Not the most effective solution but it works for me...


Gabriel(Posted 2006) [#3]
That does seem to do it, thanks.


Brucey(Posted 2006) [#4]
I always thought that once you called SetPanelPixmap() the panel would always show the image as a background, redrawing itself as necessary (like after another window moves across it, etc).

With the Linux GTK mod (it's nice when you have control over how things work!) I have the panel raising an ACTIVATE_REDRAW event when the system decides it needs redrawn (ie the panel has been invalidated in some way), which I catch and do two things. One, is to raise an EVENT_GADGETPAINT, and the other is to get the panel to redraw itself.
The GADGETPAINT event I found, was very useful if you (as the user) wanted some control over the pixmap.

I imagine the Win32/Mac GUI mods could do with something along these lines too, as it would most likely sort out the problems you've described.

I'm a firm believer of having as many EVENTs raised as possible, to allow the programmer lots of freedom to code.


Gabriel(Posted 2006) [#5]
Ahhh.. and it's not the first time I've wished there was a Windows port of your GTK module either.