?
Solved

Label always flickering

Posted on 1999-10-26
12
Medium Priority
?
1,094 Views
Last Modified: 2010-04-04
Hi

I have a form with a couple of label in it.
I can drag each one at a different position in the form.
But when i drag it, the label always flick.

When i drag the label, i use onmousemove to know the position of the cursor, then i move the label under the cursor, its at this moment that the klickering occur.

exemple :
procedure mousemove(sender:tobject; shifgt:tshiftstate; x,y:integer);
Begin
 Label.left:=x-4;
 Label.top:=y-4;
end;

Thanks

Sierra
0
Comment
Question by:sierra20
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 2159028
Try this:

Label.SetBounds(x-4, y-4, Label.Width, Label.Height);

Play also with the "DoubleBuffered" property.

Perhaps "Label.DoubleBuffered := true" or "Form1.DoubleBuffered := true".

Does this help?

Regards, Madshi.
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2159058
Why not just make sure that the label never floats under your cursor.

You can do this by adding a constant say
16 to your x and y values in all your calculations...

Rob ;-)
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2159069
//this looks fine with no flickering..

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Label1.Top := Y-16;
  Label1.Left := X-16;
end;

//just makes sure that the label never overlaps the cursor
Rob ;-)
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 6

Expert Comment

by:Jaymol
ID: 2159084
Make the label transparent.  It gets rid of stuff like that (it simply redraws it quicker!)

John.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2160105
hmm,

just place a panel (alignment alclient) on your form and place on it your labels

meikl
0
 
LVL 2

Expert Comment

by:k6__
ID: 2160572
Try on forms create :
MyLabel.Parent.DoubleBuffered := True;

Where MyLabel is your Label's name.
You Won't get a flicker again..
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2161567
Well, I've already suggested that!!

Look at the first comment in this question...
0
 

Author Comment

by:sierra20
ID: 2162692
Hi

I dont see this property (doubleBuffered), i work with delphi 3....

The label have to stay under the cursor when i drag it.

I forget to tell that there is some other code in the procedure Mousemove.

Sierra
0
 
LVL 7

Expert Comment

by:RBertora
ID: 2162741
>The label have to stay under the cursor when i drag it.

Why?

Rob ;-)
0
 

Author Comment

by:sierra20
ID: 2162871
Because the label represent an object that the user can move to an other emplacement. When the user will click on the mouse, the label will take this position.

Sierra
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 450 total points
ID: 2162931
hi sierra20,

have you tried my suggestion with the panel?

meikl
0
 

Author Comment

by:sierra20
ID: 2169443
Hi Meikl,

Yes its work, i just dont understand why the label dont flick now when you put it on a panel....

Sierra
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This is an update to some code that someone else posted on Experts Exchange. It is an alternate approach, I think a little easier to use, & makes sure that things like the Task Bar will update.
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question