..
Posted: Tue Jun 29, 2004 12:59 am
I have the solution. It just need to be converted from another language.
- np
- np
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
RedrawWindow_(WindowID(#Window_Main),0,0,#RDW_INTERNALPAINT|#RDW_UPDATENOW)
Code: Select all
UpdateWindow_(WindowID())
Code: Select all
SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, GetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE) | $02000000) ; #WS_EX_COMPOSITED)
Code: Select all
Declare Resize()
Enumeration
#Window_0
EndEnumeration
Enumeration
#Listview_0
#String_0
#Button_0
#Text_0
EndEnumeration
; don't really need to be global..
Global cx.l, cy.l, wpi.l, f.l
Procedure Open_Window_0()
If OpenWindow(#Window_0, 311, 255, 596, 292, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered , "blah..")
; **
SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, GetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE) | $02000000) ; #WS_EX_COMPOSITED)
If CreateGadgetList(WindowID())
ListViewGadget(#Listview_0, 0, 5, 290, 175)
StringGadget(#String_0, 300, 5, 295, 175, "")
ButtonGadget(#Button_0, 5, 185, 285, 105, "")
TextGadget(#Text_0, 325, 205, 155, 30, "This is a test...")
ReSize()
EndIf
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
If Event = #PB_EventGadget
; Debug "WindowID: " + Str(EventWindowID())
GadgetID = EventGadgetID()
If GadgetID = #Listview_0
;
ElseIf GadgetID = #String_0
;
ElseIf GadgetID = #Button_0
;
EndIf
ElseIf Event = #PB_Event_SizeWindow
ReSize()
EndIf
Until Event = #PB_EventCloseWindow
End
;
Procedure ReSize()
f = #SWP_NOACTIVATE|#SWP_NOZORDER
cy = WindowHeight()
cx = WindowWidth()
hw = cx/2
hh = cy/2
wpi = BeginDeferWindowPos_(4) ; Pass the number of windows To be re-sized
; Params For DeferWindowPos
; 1) The value passed from BeginDeferWindowPos
; 2) The Window handle (retrieved from GetDlgItem)
; 3) A value specifing 'Z-order' (ignored here)
; 4) x,y,w,h of window
; 5) Flags (the values in 'f' seem To work best
DeferWindowPos_(wpi,GetDlgItem_(WindowID(#Window_0),0),0,0,0,hw,hh,f)
DeferWindowPos_(wpi,GetDlgItem_(WindowID(#Window_0),1),0,hw+1,0,(cx-(hw+1)),hh,f)
DeferWindowPos_(wpi,GetDlgItem_(WindowID(#Window_0),2),0,0,hh+1,hw,cy-(hh+1),f)
DeferWindowPos_(wpi,GetDlgItem_(WindowID(#Window_0),3),0,hw+1,hh+1,(cx-(hw+1)),cy-(hh+1),f)
EndDeferWindowPos_(wpi)
wpi = 0 ; clearit
EndProcedure
Code: Select all
SetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE, GetWindowLong_(WindowID(#Window_0), #GWL_EXSTYLE) | $02000000) ; #WS_EX_COMPOSITED)
Code: Select all
If Message=#WM_ERASEBKGND
Result=-1 ; or #NULL the result is the same...
EndIf
Has always worked for me.Excludes the area occupied by child windows [gadgets] when drawing occurs within the parent window. This style is used when creating the parent window.
I tried it. Can't say if it worked or not. Because I've yet to encounterEl_Choni wrote:Has anybody tried adding #WS_CLIPCHILDREN to the window #GWL_STYLE, as I suggested? (I think OpenWindow should use it by default)
Has always worked for me.Excludes the area occupied by child windows [gadgets] when drawing occurs within the parent window. This style is used when creating the parent window.
No I just meant that I don't have flickering, so it's hard for me to codehalo wrote:There shouldn't be anything wrong with the code. I did not write this. I just copied it out of the "samples" directory because I knew it would flicker, just like every other PureBasic program I run.
I Know what the problem was with using WS_CLIPCHILDREN... you can't simply use it on the main window... you must use it on all gadgets that are parents of anything that gets resized... When you do this, there is absolutly no flickering!Has anybody tried adding #WS_CLIPCHILDREN to the window #GWL_STYLE, as I suggested? (I think OpenWindow should use it by default)
Code: Select all
Procedure ReduceFlicker_Enum(handle.l,Param.l)
SetWindowLong_(handle,#GWL_STYLE,GetWindowLong_(handle,#GWL_STYLE)|#WS_CLIPCHILDREN)
ProcedureReturn #True
EndProcedure
Procedure ReduceFlicker(WindowNumber.l)
ReduceFlicker_Enum(WindowID(WindowNumber),0)
EnumChildWindows_(WindowID(WindowNumber),@ReduceFlicker_Enum(),0)
EndProcedure
Code: Select all
LockWindowUpdate_(WindowID())
...
LockWindowUpdate_(0)
UpdateWindow_(WindowID())