TToolTipManager on dynamically created frame

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

TToolTipManager on dynamically created frame

Postby Ian Hinson » October 28th, 2010, 8:45 am

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: 9
Joined: June 20th, 2004, 12:31 pm
Location: Melbourne, Australia

Re: TToolTipManager on dynamically created frame

Postby Kambiz » October 28th, 2010, 1:49 pm

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
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests