TToolTipManager on dynamically created frame

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

TToolTipManager on dynamically created frame

Postby Ian Hinson » 28/10/10 08:45

It works OK when I drop a frame onto a form at design-time where the frame contains
1) an edit control and
2) a ToolTipManager.
By properly adding and configuring a ToolTipItem for the edit box, the tool tip appears correctly on the embedded frame at run-time.

However if I create the frame at run-time like this:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  frame1: TFrame1;
begin
  frame1 := TFrame1.Create(Self);
  frame1.Name := 'Frame1';
  frame1.Parent := Self;
end;

The frame appears on the form ok, but the tool tip does not appear to work.
Am I doing this correctly?
I don't get why the tool tip works ok when the frame is embedded at design-time, but not if it is embedded at run-time.

Thanks.
Ian
Ian Hinson
Active Member
Active Member
 
Posts: 5
Joined: 20/06/04 12:31
Location: Melbourne, Australia

Re: TToolTipManager on dynamically created frame

Postby Kambiz » 28/10/10 13:49

I don't know why this happens, but I have a solution.

After setting Parent property of the frame, call RebuildToolTips method of the ToolTipManager.

Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  frame1: TFrame1;
begin
  frame1 := TFrame1.Create(Self);
  frame1.Name := 'Frame1';
  frame1.Parent := Self;
  frame1.ToolTipManager1.RebuildToolTips;   // this line resolves the problem
end;
Kambiz

Donate a cup of food for free: Click to Give @ The Hunger Site
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2007
Joined: 07/03/03 19:10
Location: Tehran, Iran


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest