Gadget flickering
Gadget flickering
Every PB app I have ever seen has severe flickering when the window is resized. I used a SetWindowCallback @...etc., but it still happens. How can I make this stop?
Perhaps you should check your message handling in the callback... You might be redrawing the window while it's resizing or something..
(just a thought that struck me) :roll:
(just a thought that struck me) :roll:
AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
You can also try this to prevent gadget flickering:
Code: Select all
SetWindowLong_(WindowID(), #GWL_STYLE, GetWindowLong_(WindowID(), #GWL_STYLE)|#WS_CLIPCHILDREN)
El_Choni
That's kind of lame that PB can't make a window without extreme flickering. I experience this in EVERY pb app, including the editor, but don't get it with any other windows program. Maybe the developer should consider a command like the BlitzPlus SetGadgetLayout(), where you can lock the edges of a gadget to one side of the parent window.
If you experience "flickering" it is because that is the way you have programmed it. It is up to the programmer to deal wth how the window and gadgets are redrawn when they are resized.
The easiest way is of course to just send a refresh, which is what will give you the flicker effect because everything is redrawn (and in a callback it can be redrawn hundreds of times a second). Since this is the easiest way, you will see everyone use this method. If you actually take the time to deal with it better, you can eliminate this.
By the way, running the BlitzPlus demo with a resizable form with gadgets on it... I also see flickering. Especially if you add a statusbar to the bottom.
The easiest way is of course to just send a refresh, which is what will give you the flicker effect because everything is redrawn (and in a callback it can be redrawn hundreds of times a second). Since this is the easiest way, you will see everyone use this method. If you actually take the time to deal with it better, you can eliminate this.
By the way, running the BlitzPlus demo with a resizable form with gadgets on it... I also see flickering. Especially if you add a statusbar to the bottom.
Well if that's the case, then the PureBasic IDE is programmed wrong, too.
Just look at this sample. When you resize the window, the whole window flashes on and off:
Just look at this sample. When you resize the window, the whole window flashes on and off:
Code: Select all
;
; ------------------------------------------------------------
;
; PureBasic - Gadget example file
;
; (c) 2003 - Fantaisie Software
;
; ------------------------------------------------------------
;
#WindowWidth = 640
#WindowHeight = 480
If OpenWindow(0, 0, 0, #WindowWidth, #WindowHeight, #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget, "PureBasic - Gadget Demonstration")
If CreateGadgetList(WindowID())
TextGadget(7, 10, 5, 700, 15, "PureBasic splitter demonstation with Editor, ScrollArea, ExplorerTree and Web gadgets. Feel the power...")
WebGadget(0, 10, 10, 300, 20, "http://www.purebasic.com")
EditorGadget(1, 115, 10, 100, 190)
For k=1 To 10
AddGadgetItem(1, k-1, "Line "+Str(k))
Next
ExplorerTreeGadget(3, 115, 10, 100, 190, "", #PB_Explorer_AlwaysShowSelection|#PB_Explorer_FullRowSelect|#PB_Explorer_MultiSelect)
ScrollAreaGadget(6, 0, 0, 400, 400, 1000, 1000, 1)
ButtonGadget(20, 20, 20, 200, 200, "Scroll Area !")
CloseGadgetList()
SplitterGadget(2, 0, 0, #WindowWidth/2, #WindowHeight/2, 1, 0)
SplitterGadget(4, 0, 0, #WindowWidth, #WindowHeight, 3, 2, #PB_Splitter_Vertical)
SplitterGadget(5, 0, 25, #WindowWidth, #WindowHeight-25, 4, 6, #PB_Splitter_Vertical)
SetGadgetState(5, 500)
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_Gadget
Select EventGadgetID()
Case 8
SetGadgetState(5, 333)
SetGadgetState(2, 333)
SetGadgetState(11, 5)
Case 20
Debug "ok"
EndSelect
ElseIf EventID = #PB_Event_SizeWindow
ResizeGadget(5, -1, -1, WindowWidth(), WindowHeight()-25) ; Our 'master' splitter gadget
EndIf
Until EventID = #PB_EventCloseWindow
EndIf
End
-
- Enthusiast
- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
I can see the graphcis in some of the gadgets disappear (in the example above) before they are redrawn.
The problem appears to be with the WM_ERASEBKGND taking too long before the gadgets are redrawn.
The problem goes away when the WM_ERASEBKGND is intercepted, but then the screen looks slightly messy.
-Anthony
The problem appears to be with the WM_ERASEBKGND taking too long before the gadgets are redrawn.
The problem goes away when the WM_ERASEBKGND is intercepted, but then the screen looks slightly messy.
-Anthony
Minimal flickering at work PC:
WinXP Home SP1
single monitor
cheapo onboard 32mb S3 video
XP visual settings make no difference
Nasty flickering on home PC:
WinXP Home SP1
dual monitor
#1 AGP 32mb ATI All-In-Wonder Radeon
#2 PCI 32mb nVidia ???
XP visual settings make no difference (other than disabling *Show window contents while dragging*)

WinXP Home SP1
single monitor
cheapo onboard 32mb S3 video
XP visual settings make no difference
Nasty flickering on home PC:
WinXP Home SP1
dual monitor
#1 AGP 32mb ATI All-In-Wonder Radeon
#2 PCI 32mb nVidia ???
XP visual settings make no difference (other than disabling *Show window contents while dragging*)


What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1
- NoahPhense
- Addict
- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
..
zero flicker.. but then I don't need to view my box size as I'm dragging,
so it's turned off ... saves on system resources..

- np
*edit*
I decided to try it, I turned on 'show contents while dragging' .. no flicker
** NVidia GeForce4 440 GO 128bit 64mb DDR **
It's probably your refresh rate.. turn it up ..
so it's turned off ... saves on system resources..

- np
*edit*
I decided to try it, I turned on 'show contents while dragging' .. no flicker
** NVidia GeForce4 440 GO 128bit 64mb DDR **
It's probably your refresh rate.. turn it up ..
I enable the XP eye candy because I want to see what others will see and it's my guess the average user (not programmer) has eye candy set high.zero flicker.. but then I don't need to view my box size as I'm dragging,
so it's turned off ... saves on system resources

But now I'm not so sure what they'll see.

I'll try this when I get home tonight.It's probably your refresh rate.. turn it up ..
What goes around comes around.
PB 5.21 LTS (x86) - Windows 8.1
PB 5.21 LTS (x86) - Windows 8.1