Windows update messages
Posted: Wed Feb 06, 2013 11:12 am
I have transfered a large project from 4.x to 5.1 now, which did not make real problems - thanks for this to Fred for his amazing work.
But today I saw, that a complex window with multiple bitmaps and list icon gadgets do not show all buttons on certain conditions. I tried to simulate the situation with a short code and here is the result:
The code above is not an elegant one and the SendMessage and RedrawWindow calls seem to be useless (or even the reason for the issue), but in my project they do a fine job (most of the time) to get quicker screen updates.
So where's the problem? Not so easy to see, when you press 'A' to open the second window and press 'X' to close it, you won't see an issue, even if you do this multiple time. But when you press and hold the shift key while pressing 'A' you should get the second window without the imagebuttons. This effect may be seen already when opening the window the first time or after opening/closing the window multiple times (shift+A/shift+X).
Does anyone know, why the shift key influences the redraw mechanism of the window? Can I get rid of the problem without eliminating the RedrawWindows call?
But today I saw, that a complex window with multiple bitmaps and list icon gadgets do not show all buttons on certain conditions. I tried to simulate the situation with a short code and here is the result:
Code: Select all
Enumeration
#Window_0
#Window_1
#Button_0
#Button_8
#ListIcon_0
EndEnumeration
Procedure Redraw()
SendMessage_(GadgetID(#ListIcon_0),#WM_SETREDRAW,#False,0)
DisableWindow(#Window_0,1)
HideWindow(#Window_1,0)
SetActiveWindow(#Window_1)
ClearGadgetItems(#ListIcon_0)
For i=0 To 99
AddGadgetItem(#ListIcon_0,-1,Str(Random(999999999))+#LF$+Str(Random(999999999))+#LF$+Str(Random(999999999))+#LF$+Str(Random(999999999)))
Next i
SendMessage_(GadgetID(#ListIcon_0),#WM_SETREDRAW,#True,#True)
RedrawWindow_(WindowID(#Window_1),#Null,#Null,#RDW_INVALIDATE|#RDW_ERASE)
EndProcedure
OpenWindow(#Window_0, 0, 0, 380, 110, "", #PB_Window_SystemMenu)
ButtonGadget(#Button_0, 132, 34, 100, 25, "A")
AddKeyboardShortcut(Window_0,#PB_Shortcut_A,#Button_0)
AddKeyboardShortcut(Window_0,#PB_Shortcut_A|#PB_Shortcut_Shift,#Button_0)
Global Button_0, Button_0, Button_1, Button_2, Button_3, Button_4, Button_5, Button_6, Button_7, Button_8, ListIcon_0
OpenWindow(#Window_1, 0, 0, 600, 400, "", #PB_Window_SystemMenu|#PB_Window_Invisible)
Button_0 = ButtonGadget(#PB_Any, 132, 34, 100, 25, "")
Button_0 = ButtonGadget(#PB_Any, 30, 360, 50, 30, "")
Button_1 = ButtonGadget(#PB_Any, 80, 360, 40, 30, "")
Button_2 = ButtonGadget(#PB_Any, 120, 360, 40, 30, "")
Button_3 = ButtonGadget(#PB_Any, 160, 360, 40, 30, "")
Button_4 = ButtonGadget(#PB_Any, 200, 360, 40, 30, "")
ButtonImageGadget(#PB_Any, 240, 360, 40, 30,LoadIcon_(0,#IDI_EXCLAMATION))
ButtonImageGadget(#PB_Any, 290, 360, 40, 30,LoadIcon_(0,#IDI_WINLOGO))
ButtonImageGadget(#PB_Any,330, 360, 40, 30,LoadIcon_(0,#IDI_APPLICATION))
ButtonGadget(#Button_8, 380, 360, 40, 30, "X")
ListIconGadget(#ListIcon_0, 20, 20, 490, 344, "Column 1", 100)
AddGadgetColumn(#ListIcon_0, 1, "2", 100)
AddGadgetColumn(#ListIcon_0, 2, "3", 100)
AddGadgetColumn(#ListIcon_0, 3, "4", 100)
AddKeyboardShortcut(#Window_1,#PB_Shortcut_X,#Button_8)
AddKeyboardShortcut(#Window_1,#PB_Shortcut_X|#PB_Shortcut_Shift,#Button_8)
AddKeyboardShortcut(#Window_1,#PB_Shortcut_Escape,#Button_8)
Repeat
event=WaitWindowEvent()
Select event
Case #PB_Event_CloseWindow
End
Case #PB_Event_Menu,#PB_Event_Gadget
Select EventGadget()
Case #Button_0
Debug "ok"
Redraw()
Case #Button_8
HideWindow(#Window_1,1)
DisableWindow(#Window_0,0)
SetActiveWindow(#Window_0)
EndSelect
EndSelect
ForEver
So where's the problem? Not so easy to see, when you press 'A' to open the second window and press 'X' to close it, you won't see an issue, even if you do this multiple time. But when you press and hold the shift key while pressing 'A' you should get the second window without the imagebuttons. This effect may be seen already when opening the window the first time or after opening/closing the window multiple times (shift+A/shift+X).
Does anyone know, why the shift key influences the redraw mechanism of the window? Can I get rid of the problem without eliminating the RedrawWindows call?