(repeat of the post in the bug thread, sorry for double posting it)
Fred, you wanted an example. here is one
This is what I have to do to get these listsiconviews to be flicker free.
Please note as I entioned elsewhere here that this is still imperfect.
There appears to be a framerate issue, but at least the flickering is gone.
In the loop change MainWindow_Resize(#True) to MainWindow_Resize(#False) to turn off my "trick".
At least on my system using just SmartWindowRefresh() or not using it at all
causes the lists to flicker, esp. the scrollbars seem to flicker if you size the window slowly.
Obviously this only happens with "solid" windows, classic look has hardly any gfx issues.
If anyone know how to get rid of that list little glitch (low frame rate for refrash)
I'd be very happy, but I can actualy live with this now.
SmartWindowRefresh() plus my tweaks as seen in this example,
and things are pretty darn flicker free here.
Hopefully the rest of you get similar results!
Code: Select all
Procedure MainWindow_Resize(test=#False)
Protected ww.l,wh.l,w.l,h.l,x.l,y.l
If test=#True
;disable redrawing for window 0
SendMessage_(WindowID(0),#WM_SETREDRAW,#False,0)
EndIf
ww=WindowWidth(0)
wh=WindowHeight(0)
w=ww/4
h=(wh/2)
x=0
y=0
ResizeGadget(0,x,y,w,h)
SendMessage_(GadgetID(0),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x+w
ResizeGadget(1,x,y,w,h)
SendMessage_(GadgetID(1),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x+w
ResizeGadget(2,x,y,w,h)
SendMessage_(GadgetID(2),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x=GadgetX(2)+GadgetWidth(2)
w=ww-x
ResizeGadget(3,x,y,w,h)
SendMessage_(GadgetID(3),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
y=h
x=0
w=ww/4
h=wh-h
ResizeGadget(4,x,y,w,h)
SendMessage_(GadgetID(4),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x+w
ResizeGadget(5,x,y,w,h)
SendMessage_(GadgetID(5),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x+w
ResizeGadget(6,x,y,w,h)
SendMessage_(GadgetID(6),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
x=GadgetX(6)+GadgetWidth(6)
w=ww-x
ResizeGadget(7,x,y,w,h)
SendMessage_(GadgetID(7),#LVM_SETCOLUMNWIDTH,0,#LVSCW_AUTOSIZE_USEHEADER)
If test=#True
;enable redrawing for window 0 again
SendMessage_(WindowID(0),#WM_SETREDRAW,#True,0)
;invalidate the entire window, erase background and repaint
RedrawWindow_(WindowID(0),#Null,#Null,#RDW_INVALIDATE|#RDW_UPDATENOW|#RDW_ERASE)
EndIf
EndProcedure
w_width=800
w_height=600
OpenWindow(0, 0, 0, w_width, w_height, "", #PB_Window_Invisible|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_SizeGadget)
CreateGadgetList(WindowID(0))
SmartWindowRefresh(0, 1)
params=#LVS_EDITLABELS|#LVS_SORTASCENDING|#LVS_NOSORTHEADER|#PB_ListIcon_FullRowSelect
w=w_width/4
h=(( w_height-MenuHeight())/4)
x=0
y=0
ListIconGadget(0,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(0,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(0,#PB_Gadget_FrontColor,0)
x+w
ListIconGadget(1,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(1,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(1,#PB_Gadget_FrontColor,0)
x+w
ListIconGadget(2,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(2,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(2,#PB_Gadget_FrontColor,0)
x=GadgetX(2)+GadgetWidth(2)
w=w_width-x
ListIconGadget(3,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(3,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(3,#PB_Gadget_FrontColor,0)
y=GadgetY(0)+GadgetHeight(0)
x=0
w=w_width/4
h=(w_height-MenuHeight())-y
ListIconGadget(4,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(4,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(4,#PB_Gadget_FrontColor,0)
x+w
ListIconGadget(5,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(5,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(5,#PB_Gadget_FrontColor,0)
x+w
ListIconGadget(6,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(6,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(6,#PB_Gadget_FrontColor,0)
x=GadgetX(6)+GadgetWidth(6)
w=w_width-x
ListIconGadget(7,x,y,w,h,"LIST: 0",100,params)
SetGadgetColor(7,#PB_Gadget_BackColor,RGB(255,255,213))
SetGadgetColor(7,#PB_Gadget_FrontColor,0)
HideWindow(0,0)
SetActiveGadget(0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_SizeWindow
MainWindow_Resize(#True) ;change this to #False to turn of my repaint "trick"
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
EDIT:
PS! There is no way to implement some of those tweaks into SmartWindowRefresh() I assume?
WHat if you also added a repaint callback similar to how the window callback is.
That way we could just create a procedure, do all our resising/calculations etc. in that.
And each time PB gets a paint of redraw event, it will just call that callback procedure.
It certainly would be very cpu efficient and system friendly to do it this way or?
So that you could disable repaint at start and do a paint at the end of the callback internally in PB.
EDIT:
Either something like that or my idea in
http://www.purebasic.fr/english/viewtopic.php?t=20531
I assume Linux and Mac do NOT have have this issue?
But if we can get near flicker free
(and my code above is pretty close except for the slow "frame rate")
you will definetly give PB a major edge over other development environmets
