Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 13, 2019 5:19 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 8:51 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Hello,

I have this code in the open event of Canvas1:

#If TargetWin32 then //Windows only
Me.DoubleBuffer = True
Me.EraseBackground = False

#else //Linux and Macintosh

#endif

and when I scroll I still see the background being erased and get flickering.

How can I fix that?

Thanks.

Lennox.


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 10:05 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
How are you scrolling?


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 10:19 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
This is the code in ScrollBar1

In the ScrollBar1.ValueChanged event:
#If TargetWin32 then //Windows only
Canvas1.DoubleBuffer = True
Canvas1.EraseBackground = False

#else //Linux and Macintosh

#endif

Canvas1.Refresh



In the ScrollBar1ScrollBar1.Open event:
ScrollBar1.Maximum = Max(Canvas1.Height - self.Height, 0)
ScrollBar1.Value = Min(ScrollBar1.Value, ScrollBar1.Maximum)


Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 2:37 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Canvas.Refresh defaults to EraseBackground = True. That is causing your flicker. Call it as
canvas1.refresh(false)


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 7:43 pm 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Thanks timhare,
I did that but no improvements.
Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Wed Jun 15, 2011 11:07 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
What are you scrolling? Are you drawing an image in Paint? Do you have controls sitting on the canvas? I don't see you calling canvas.scroll. Are you drawing offset by scrollbar.value? We need more information.


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Thu Jun 16, 2011 12:17 am 
Offline

Joined: Mon May 30, 2011 12:56 am
Posts: 702
If you have a big picture and a small canvas:
You want to scroll the picture around so that you see part of it through the canvas.

Set the canvas erasebackground = false in design time. Doesnt matter if it is set on the Mac too.
I dont think doublebuffer makes much difference

In the scrollbar valuechanged event, use canvas1.invalidate false

Set hscroll maximum to picture.width - canvas.width
set vscroll maximum to picture.height - canvas.height

In the canvas paint event,

g.drawpicture bigpicture,0,0,canvas.width,canvas.height,hscroll1.value *-1,vscroll1.value *-1


Do NOT set the .background of the canvas in code as that causes a flash no matter what settings you use.


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Thu Jun 16, 2011 6:55 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Thanks timhare and kermit and sorry about me not being specific.

I have controls sitting on the canvas and I am drawing offset by scrollbar.value.

Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Thu Jun 16, 2011 11:32 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
If you have controls on the canvas, you will have flicker.


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Thu Jun 16, 2011 11:48 am 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
timhare wrote:
If you have controls on the canvas, you will have flicker.

that should be fixed long time ago.. is there still a feedback report for this?
If so, let's all add +1 to it..;)

I can get up to no other dev env wich has the same problem on windows...(yet)

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Fri Jun 17, 2011 8:52 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
OK thanks, flicker cannot be avoided on scrolling because of the canvas redrawing process I figure.

I have several bevelButtons on the canvas and if I mouse-over them fast they become invisible and then visible again, I have no code in their MouseEnter or MouseExit events. What is causing that and how can that be fixed.

Thanks.

Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Fri Jun 17, 2011 9:23 am 
Offline

Joined: Mon Sep 22, 2008 9:01 pm
Posts: 61
lenpartico wrote:
OK thanks, flicker cannot be avoided on scrolling because of the canvas redrawing process I figure.

I have several bevelButtons on the canvas and if I mouse-over them fast they become invisible and then visible again, I have no code in their MouseEnter or MouseExit events. What is causing that and how can that be fixed.

Thanks.

Lennox


drawinto should get the job done


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Fri Jun 17, 2011 10:53 am 
Offline

Joined: Fri Sep 30, 2005 10:49 pm
Posts: 504
Thanks pawn,
I checked drawinto in the LR and got this

RectControl.DrawInto
Method
RectControl.DrawInto ( g as Graphics,x as Integer, y as Integer )
Draws the contents of the RectControl into the specified Graphics context. The parameters x and y are the coordinates of the top, left corner.

I am using this in Canvas1 Paint event:
Bevelbutton1.Top = 100 - ScrollBar1.value
Bevelbutton2.Top = 150 - ScrollBar1.value
Bevelbutton3.Top = 200 - ScrollBar1.value
Bevelbutton4.Top = 250 - ScrollBar1.value
.
.
.

How do I use Drawinto with those parameters?

Thanks.

Lennox


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Sat Jun 18, 2011 10:08 pm 
Offline

Joined: Mon Sep 22, 2008 9:01 pm
Posts: 61
Actually i'm not sure if it'll help with the way you're doing it

But with what you have its probably worth attempting at least,

Bevelbutton1.DrawInto(g,Bevelbutton1.left,Bevelbutton1.top)
Bevelbutton2.DrawInto(g,Bevelbutton2.left,Bevelbutton2.top)
Bevelbutton3.DrawInto(g,Bevelbutton3.left,Bevelbutton3.top)
Bevelbutton4.DrawInto(g,Bevelbutton4.left,Bevelbutton4.top)


Top
 Profile  
Reply with quote  
 Post subject: Re: DoubleBuffer/EraseBackground Help requested
PostPosted: Sun Jun 19, 2011 8:20 am 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
I always do this for windows:

#if TargetWin32 then
me.doubleBuffer = True
me.EraseBackground =Flase
#endif


when refreshing a canvas use (on windows):
Canvas.Refresh(False)

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group