Gadget flickering

Everything else that doesn't fall into one of the other PB categories.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Sparkie wrote: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. :wink:
True true, I keep forgetting there are "others - out there"... lol

;)

- np
GreenGiant
Enthusiast
Enthusiast
Posts: 252
Joined: Fri Feb 20, 2004 5:43 pm

Post by GreenGiant »

Surely instead of turning the refresh rate up it would make more sense to turn it down. Then the computer has more time to draw the window contents before it has to refresh. Or am I missing something?
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

This isn't a refresh rate problem, I am sure of that...

If it was, all programs that don't impliment double-buffering would flicker...
I would think that anyone complaining of flicker problems would notice if their entire screen was going crazy :wink:
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

This isn't a refresh rate problem, I am sure of that...
I'll agree with that. Four hours ago there was no flickering here on my work PC. I'm still on my work PC and I just tried the exact same code again, and now I get the same nasty flickering like my home PC.

I know for a fact there was no flickering this morning because I was amazed at the difference between my 2 pc's. 8O

Reboot and still flickering.
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Sparkie wrote:
This isn't a refresh rate problem, I am sure of that...
I'll agree with that. Four hours ago there was no flickering here on my work PC. I'm still on my work PC and I just tried the exact same code again, and now I get the same nasty flickering like my home PC.

I know for a fact there was no flickering this morning because I was amazed at the difference between my 2 pc's. 8O

Reboot and still flickering.
Just tell people there's no extra charge for the flickering, oh, and add
a warning for epilepsy.

- np
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

LOL @ NoahPhense
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post by NoahPhense »

Paul wrote:LOL @ NoahPhense
Ok, now I'm being serious.. I'm running 3.91b2.. can someone share some
flickering code? I've tried to make mine flicker, but can't.

I'd really like share in this experience.

- np

Flicker 1.0 beta coming soon.
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

I don't even need code to get the flickering at work now. All I have to do is resize my jaPBe or PB IDE window and I get the same results as the code from page 1 of this thread. :x

I've been fiddling with this @#?! computer for 2 hours trying to get it back to where it was. Problem is, I didn't make any changes to any settings. It just started flickering out of nowhere!!!

PB 3.91 B2
WinXP Home SP1
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Re: ..

Post by tinman »

NoahPhense wrote:Ok, now I'm being serious.. I'm running 3.91b2.. can someone share some flickering code? I've tried to make mine flicker, but can't.

I'd really like share in this experience.
Try the layout demo on my website. It's got mad ass slow resize calculations and resizes during window sizing and flickers like hell for me. Which is a pain because I don't want it to flicker :)
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

It flickers here...

Also, it appears you're handling the WM_SIZING event instead of WM_SIZE....
Try turning off "show window contents while dragging" to see what I mean...
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

it looks weird when sizing it, if you dont have the over bloated "show window content while dragging" function on.
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

Exactly what I was saying... He's handling the WM_SIZING instead of WM_SIZE....

I have noticed one thing that's very consistant about the flickering (on XP Pro at least)... When I turn off visual styles and set it to classic mode, none of the programs mentioned in this thread flicker for me...
I'm going to look into this a little further... I did run accross some oddities in how (and which) messages are sent with XP Styles ON/OFF while working on my skin engine...
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

PolyVector wrote:It flickers here...
That's the point, NoahPhense wants to see some flickering ;)
PolyVector wrote:Also, it appears you're handling the WM_SIZING event instead of WM_SIZE....
Try turning off "show window contents while dragging" to see what I mean...
Yes, that is what I am doing. I'd like the the UI to resize as the user drags the window (WM_SIZING), not when they stop (WM_SIZE). It must be possible, I've seen other applications do it (I guess my algorithms/code is just too slow). Working with WM_SIZE is a lot cleaner, but not the effect I am looking for.

Edit: yes, I see the difference now. Damn, why did I never notice that before? I've tested with both settings in the past and it's been OK. Grrr.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

I do hope somebody can shed a little light on this flickering issue... It is very difficult to test my skin engine (with PB apps) when the windows flicker like this...
PolyVector
Enthusiast
Enthusiast
Posts: 499
Joined: Wed Sep 17, 2003 9:17 pm
Location: Southern California
Contact:

Post by PolyVector »

sorry for the double post :oops:
I think I know the problem.....
When the window is resized, it is automatically updated... Now The problem is that the gadgets are updated at the exact same time that your program decides to resize them (on the pb resize event)

To prevent this problem... simply add this line after every gadget resize
RedrawWindow_(GadgetID(GadgetNumber),0,0,#RDW_INTERNALPAINT|#RDW_UPDATENOW)

This is a less-than-elegant way of doing it, but I get very nice results...

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 
      
      ;-##########This is the only added line :)##########
      RedrawWindow_(GadgetID(5),0,0,#RDW_INTERNALPAINT|#RDW_UPDATENOW)    
      
      EndIf 
    
    
  Until EventID = #PB_EventCloseWindow 
  
EndIf 

End  
Maybe someone can improve on this idea? :D
There still seems to be the problem of gadgets not getting updated when they are not resized...look at the text-at-the-top while resizeing... It doesn't refresh...

Added: This technique doesn't seem to work in every situation... PB needs a built-in solution for this... It is a high-level language after all...
Post Reply