| View previous topic :: View next topic |
| Author |
Message |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Nov 06, 2004 2:44 am Post subject: Flicker |
|
|
Hi... I'm facing a problem about flicker when updating a TEXT element.
Try this script to see what I'm talking about. The flicker can be somewhat
corrected by splitting the clock display up into separate texts and just
updating those separately. But I want to add in an option for custom font
and since fonts are different sizes/widths, breaking the text up into parts
will not work always.
Does anyone know of any solutions that will get rid of this flicker?
Thanks in advance!
| Code: | title Clock Test
%%Screen_Height = @sysinfo(screenheight)
%%Screen_Width = @sysinfo(screenwidth)
DIALOG CREATE,Clock Test,-1,0,%%Screen_Width,%%Screen_Height
DIALOG ADD,STYLE,S_TIME,Arial Rounded MT Bold,160,BC
DIALOG ADD,TEXT,T_TIME,217,0,%%Screen_Width,250,,,S_TIME
DIALOG SHOW
goto timer
:Evloop
wait event,1
goto @event()
:Timer
%%Raw_Date = @datetime(h|nn|ss|AM/PM)
PARSE "%%Hour;%%Minute;%%Second;%%AMPM",%%Raw_Date
dialog set,T_TIME,%%Hour:%%Minute:%%Second
goto evloop
:Close
exit |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Sat Nov 06, 2004 10:23 am Post subject: |
|
|
You must have a slower computer than me because if you hadn't mentioned it, I wouldn't have noticed it. I think it's just the usual Windows screen redraw. It takes a noticeable time to redraw something that big. I don't think there is anything you can do about it.
With bitmaps, in a lower level language, you can reduce flicker by double buffering. You keep two copies of the bitmap and switch from one to the other instead of redrawing the existing one. But you can't do that in VDS, and you can't do it at all with text elements. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 06, 2004 12:14 pm Post subject: |
|
|
Hi FreezingFire,
Over here it was also flickering. The following code reduced it a lot, but it still seems that it doesn't work 100% good...
| Code: | title Clock Test
option decimalsep,.
%%Screen_Height = @sysinfo(screenheight)
%%Screen_Width = @sysinfo(screenwidth)
DIALOG CREATE,Clock Test,-1,0,%%Screen_Width,%%Screen_Height
DIALOG ADD,STYLE,S_TIME,Arial Rounded MT Bold,160,BC
DIALOG ADD,TEXT,T_TIME1,217,0,%%Screen_Width,250,,,S_TIME
DIALOG ADD,TEXT,T_TIME2,217,0,%%Screen_Width,250,,,S_TIME
DIALOG SHOW
goto timer
:Evloop
wait event,0.01
goto @event()
:Timer
%%Raw_Date = @datetime(h|nn|ss|AM/PM)
PARSE "%%Hour;%%Minute;%%Second;%%AMPM",%%Raw_Date
if @equal(@pos(".",@fdiv(%%Second,2)),0)
dialog set,T_TIME1,%%Hour:%%Minute:%%Second
dialog hide,T_TIME2
dialog show,T_TIME1
else
dialog set,T_TIME2,%%Hour:%%Minute:%%Second
dialog hide,T_TIME1
dialog show,T_TIME2
end
goto evloop
:Close
exit |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Sat Nov 06, 2004 1:04 pm Post subject: |
|
|
hi ff,
i haven't tried this but i reckon that if you just change each digit when needed, that would reduce the flicker on the items that don't change
this means having to separate each digit in your time HH:NN:SS and dealing with each one individually and separately
your routine would require that you do not redraw an item unless it needs to be changed
serge |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Nov 06, 2004 2:49 pm Post subject: |
|
|
Thanks guys for the help I think I'm going to have to just do separate
digits. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Sat Nov 06, 2004 3:53 pm Post subject: |
|
|
Hey Julian,
In delphi there is a property DOUBLEBUFFERED for Tform which you can set to the Form to TRUE. That will cause everything to become doublebuffered.
I'm not sure if it's available in the version of delphi you guys are using when developing vds though. That could be a optional style added to the form? |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Nov 06, 2004 6:25 pm Post subject: Re: Flicker |
|
|
| FreezingFire wrote: | Hi... I'm facing a problem about flicker when updating a TEXT element.
Try this script to see what I'm talking about. The flicker can be somewhat
corrected by splitting the clock display up into separate texts and just
updating those separately. But I want to add in an option for custom font
and since fonts are different sizes/widths, breaking the text up into parts
will not work always.
|
Using seperate text elements for HH, MM and SS is the only way I've ever
bypassed the flicker problem.
The other trick I've learned is when using images in such a manner, make
sure you reduce the color of the images as low as possible, 16 color even
if you can get away with it. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Nov 06, 2004 6:41 pm Post subject: |
|
|
| PGWARE wrote: | | In delphi there is a property DOUBLEBUFFERED for Tform which you can set to the Form to TRUE. That will cause everything to become doublebuffered. |
Does the program become (a lot) slower by using this property, or doesn't it matter that much? If not, I think it is nice if VDS can use it, because if you right now do something with changing TEXT elements, or changing the position of other elements, it always flickers, which limits you in things you can make...  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1565
|
Posted: Sat Nov 06, 2004 7:40 pm Post subject: |
|
|
Any image and all drawing operations on the form would have to be double buffered as well, which means double the memory consumption. Slower I don't think; unless the app is on a slow computer to begin with - then again any animations or images probably look pretty bad on that computer; so the user isn't expecting much.
It's why a DOUBLEBUFFER style would be nice so it can be turned on or off depending on if it is really needed. |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Sun Nov 07, 2004 11:37 am Post subject: |
|
|
I think Skit's method would work if TEXT elements weren't transparent. There would be no need to hide and show the first (lower) of the two elements. Try it in VDS 4. VDS 5 TEXT elements are transparent in order that they show the Windows XP theme background, so you can see the lower element through the upper one, and I think that this causes a redraw that results in the flicker.
I wasn't aware that Delphi supported double buffering. It doesn't seem to appear as a property in the object inspector anywhere. If it's available in the version of Delphi that is used to develop VDS 6 then I dare say that it could be made an option. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|