• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2010
  • Last Modified:

Show a custom hint window on mouse over?

Am using VirtualDrawTree for a userlist on my chat program and I would like to know how can I make a hint funcation so that it will show the a hint with the text that mouse is over but it only says on few afew secends before it fades away can anyone help ?
0
fiveuk
Asked:
fiveuk
  • 14
  • 12
1 Solution
 
kfoster11CEOCommented:
The TVirtualStringTree has this function and you can look at the source, it is opensource (I believe)

if you have the time you can get it here.   http://www.delphi-gems.com/
0
 
TheRealLokiSenior DeveloperCommented:
I think the best way to do this in a nice manner is to do as suggested in the VirtualDrawTre and VirtualStreeTree forums
make your own hint, and set it on the mouseover evet
here's my adaptation of that suggestion

type
  TForm1 = class(TForm)
    TreeView1: TTreeView;
    VirtualDrawTree1: TVirtualDrawTree;
    tHintTimer: TTimer;
    procedure VirtualDrawTree1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    procedure tHintTimerTimer(Sender: TObject);
  private
    { Private declarations }
      HintWindow: THintWindow;
      HintPosition: TRect;
  public
    { Public declarations }
  end;





procedure TForm1.VirtualDrawTree1MouseMove(Sender: TObject;
  Shift: TShiftState; X, Y: Integer);
var
    node: PVirtualNode;
  begin
    if not assigned(HintWindow) then
    begin
        HintWindow := THintWindow.Create(Sender as TControl);
        HintWindow.Parent := (Sender as TWinControl);
    end;
  HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
  HintWindow.Color := GetSysColor(COLOR_INFOBK);

  HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
  HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;
  HintPosition.Right := HintPosition.Left + 200;
  HintPosition.Bottom := HintPosition.Top + 70;

  // Show the hint window ...
  if (Sender is TVirtualDrawTree) then
  begin
      VirtualDrawTree1.GetNodeAt(x, y);
      if node <> nil then
      begin
        HintWindow.ActivateHint(HintPosition, 'above node: ' + inttostr(node.Index));

          tHintTimer.Enabled := True; // turn on the timer that will close the hint
      end;

  end
  else
  begin
      HintWindow.ActivateHint(HintPosition, 'TheHintText');
      tHintTimer.Enabled := True; // turn on the timer that will close the hint
  end;
end;


procedure TForm1.tHintTimerTimer(Sender: TObject);
begin
    tHintTimer.Enabled := False;
    if assigned(HintWindow) then
      FreeAndNil(HintWIndow);
end;
0
 
fiveukAuthor Commented:
sorry for late reply the hint window will not show up at all
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
TheRealLokiSenior DeveloperCommented:
hmm, you're right.. ok, fixed.


    VirtualDrawTree1: TVirtualDrawTree;
    tHintTimer: TTimer;



procedure TForm1.VirtualDrawTree1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    var
        node: PVirtualNode;
        NewHintText: string;
    begin
        if HintText = '*CLOSING*' then
        begin
            HintText := '';
            exit;
        end;

        NewHintText := '';
        if (Sender is TVirtualDrawTree) then
        begin
            node := (Sender as TVirtualDrawTree).GetNodeAt(x, y);
            if node <> nil then
              NewHintText := 'above node: ' + inttostr(node.Index)
// Remove the next 2 lines - they are just for testing
            else
              NewHintText := Format('X = %d, Y = %d', [X, Y]);
        end;


        if NewHintText = '' then
        begin
// Hide the hint window...
            if assigned(HintWindow) then
            begin
                tHintTimer.Enabled := False;
// move the hint off screen to avoid the need for a repaint on the controls
                HintPosition.Left := Screen.Width + 10;
                HintPosition.Top := Screen.Height + 10;
// now get rid of it
                if assigned(HintWindow) then
                  FreeAndNil(HintWindow);
            end;
        end
        else if NewHintText <> HintText then
        begin
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;
            HintPosition.Right := HintPosition.Left + 100;
            HintPosition.Bottom := HintPosition.Top + 20;

// Show the hint window...
            HintWindow.ActivateHint(HintPosition, NewHintText);
            tHintTimer.Enabled := True; // turn on the timer that will close the hint
        end;
        HintText := NewHintText;
    end;



procedure TForm1.tHintTimerTimer(Sender: TObject);
    begin
        tHintTimer.Enabled := False;
        if assigned(HintWindow) then
          FreeAndNil(HintWIndow);
        HintText := '*CLOSING*';
    end;
0
 
fiveukAuthor Commented:
ok cheers works fine but how can I add custom text and a image to the hint window allso how can I make it show were the mouse pointer is?
0
 
TheRealLokiSenior DeveloperCommented:
make "HintText: string;" a global parameter (ie. in the form's private or public block)
and you can set the position here :-
            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the mouse
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y; // same height as mouse
            HintPosition.Right := HintPosition.Left + 100; // width of hint box
            HintPosition.Bottom := HintPosition.Top + 20; // height of hint box
simply set "HINTEXT" to the text you want

To add an image to the hint window add this code inteh "create part" of the threeview mouseover event
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
(*new*)   with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 40;
                    left := 80;
                    picture.assign(image1.Picture);
                    parent := hintwindow;
                end;
(*end of new stuff*)
            end;
you can also add a TLabel in the same manner as above if you want some extra custom text.
0
 
fiveukAuthor Commented:
cherrs what would the code for extra text be?
0
 
TheRealLokiSenior DeveloperCommented:
you're really making me work for that 125 points aintcha :-p

                with TLabel.create(HintWindow) do
                begin
                    width := 60;
                    height := 16;
                    top := 20;
                    left := 4;
                    Caption := 'Extra text';
                    transparent := true;
                    parent := hintwindow;
                end;
// or a tmemo if you want workwrapping
                with TMemo.create(HintWindow) do
                begin
                    width := 60;
                    height := 60;
                    top := 20;
                    left := 4;
                    Caption := 'Extra text' + #13#10 + 'and another line';
                    readonly := true;
                    parent := hintwindow;
                end;
0
 
fiveukAuthor Commented:
would it be possable for you to make me a custom hint window like as this following image :

http://www.ct-live.net/image1.jpg

then the code to access user levels would be like this :

            if (DM.UserTyp = '3') then // payed
            begin
              TEXT1  := ChatData.Name'; // username
              TEXT2  := 'Plus member.'; // account
              Then the image code here. // account icon
            end;

can you help plz?
0
 
fiveukAuthor Commented:
and if you do help I give you max points :)
0
 
TheRealLokiSenior DeveloperCommented:
replace the code with this, and search for *SET*
this is where you put your custom text/icon
you did not explain where the icon came from, so I could not code it, but
if you put a TImage on your form for example, and load the image into that, then
set image1.visible:= false;
you will be able to see this working

procedure TForm1.VirtualDrawTree1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
    var
        node: PVirtualNode;
        NewHintText: string;
    begin
        if HintText = '*CLOSING*' then
        begin
            HintText := '';
            exit;
        end;

        NewHintText := '';
        if (Sender is TVirtualDrawTree) then
        begin
(*
            node := (Sender as TVirtualDrawTree).GetNodeAt(x, y);
            if node <> nil then
              NewHintText := 'above node: ' + inttostr(node.Index)
// Remove the next 2 lines - they are just for testing
            else
              NewHintText := Format('X = %d, Y = %d', [X, Y]);
*)
            NewHintText := 'ChatData.Name'; // *SET* your ChatData.Name text here
        end;


        if NewHintText = '' then
        begin
// Hide the hint window...
            if assigned(HintWindow) then
            begin
                tHintTimer.Enabled := False;
// move the hint off screen to avoid the need for a repaint on the controls
                HintPosition.Left := Screen.Width + 10;
                HintPosition.Top := Screen.Height + 10;
// now get rid of it
                if assigned(HintWindow) then
                  FreeAndNil(HintWindow);
            end;
        end
        else if NewHintText <> HintText then
        begin
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
//*NEW*
// add some extra text

                with TLabel.create(HintWindow) do
                begin
                    width := 60;
                    height := 16;
                    top := 22;
                    left := 24;
//                    Caption := 'Plus member.';
                    transparent := true;
                    parent := hintwindow;
                    name := 'ExtraHintLabel';;
                end;

// add an image to the hint :-)
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 20;
                    left := 4;
                    picture.assign(image1.Picture);
                    parent := hintwindow;
                    name := 'ExtraHintImage';
                end;
// end of *NEW* stuff
            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

// *NEW*
// set up the custom data. ExtraHintLabel, image
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Plus Member.'; // *SET* account here
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(Image1.Picture); // *SET* account icon here

            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;
            HintPosition.Right := HintPosition.Left + 100;
            HintPosition.Bottom := HintPosition.Top + 40;
// Show the hint window...
            HintWindow.ActivateHint(HintPosition, NewHintText);
            tHintTimer.Enabled := True; // turn on the timer that will close the hint
        end;
        HintText := NewHintText;
    end;
0
 
fiveukAuthor Commented:
ok so I would set my accounts like this

            if (DM.UserTyp = '3') then
            begin
             NewHintText := ChatData.Name;
          (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Plus Member.'; // *SET* account here
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(Image1.Picture); // *SET* account icon here
            end;

???
0
 
TheRealLokiSenior DeveloperCommented:
yep
0
 
fiveukAuthor Commented:
ok how can I make the window auto resize to the user name and account so the box allways fits the info? I really working you on this I no :)
0
 
TheRealLokiSenior DeveloperCommented:
actually, because it uses "newhinttext" to know if it should create the window, put it at the top like this
            if (DM.UserTyp = '3') then
               NewHintText := ChatData.Name;
      if NewHintText = '' then
        begin
// Hide the hint window...
...
...etc

then again at the bottom (where it is now)
...
...
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);
// set up the custom data. ExtraHintLabel, image
            if (DM.UserTyp = '3') then
            begin
                (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Plus Member.'; // *SET* account here
                (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(Image1.Picture); // *SET* account icon here
            end;
0
 
fiveukAuthor Commented:
Ok it dont move to the other accounts it just shows the same account type over and over here the full code




procedure TChatForm.VTSMouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
var
  node: PVirtualNode;
  NewHintText: string;
  ChatData: PIMData;
begin
   Node := VTS.GetNodeAt(X, Y);
if Node <> nil then
if UserTable.RecordCount > 0 then
begin
   ChatData := VTS.GetNodeData(Node);

if HintText = '*CLOSING*' then
        begin
            HintText := '';
            exit;
        end;

        NewHintText := '';
        if (Sender is TVirtualDrawTree) then
        begin
(*
            node := (Sender as TVirtualDrawTree).GetNodeAt(x, y);
            if node <> nil then
              NewHintText := 'above node: ' + inttostr(node.Index)
// Remove the next 2 lines - they are just for testing
            else
              NewHintText := Format('X = %d, Y = %d', [X, Y]);
*)
           // NewHintText := 'ChatData.Name'; // *SET* your ChatData.Name text here

            if (DM.UserTyp = '1') then
            begin
             NewHintText := ChatData.Name;
            end;

            if (DM.UserTyp = '3') then
            begin
             NewHintText := ChatData.Name;
            end;
        end;

        if NewHintText = '' then
        begin
// Hide the hint window...
            if assigned(HintWindow) then
            begin
                tHintTimer.Enabled := False;
// move the hint off screen to avoid the need for a repaint on the controls
                HintPosition.Left := Screen.Width + 10;
                HintPosition.Top := Screen.Height + 10;
// now get rid of it
                if assigned(HintWindow) then
                  FreeAndNil(HintWindow);
            end;
        end
        else if NewHintText <> HintText then
        begin
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
//*NEW*
// add some extra text

                with TLabel.create(HintWindow) do
                begin
                    width := 60;
                    height := 16;
                    top := 22;
                    left := 24;
//                    Caption := 'Plus member.';
                    transparent := true;
                    parent := hintwindow;
                    name := 'ExtraHintLabel';
                end;

// add an image to the hint :-)
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 20;
                    left := 4;
                    picture.assign(image1.Picture);
                    parent := hintwindow;
                    name := 'ExtraHintImage';
                end;
// end of *NEW* stuff
            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

// *NEW*
// set up the custom data. ExtraHintLabel, image

  {  or (DM.UserTyp = '0') // Free
    or (DM.UserTyp = '1') // Bronze
    or (DM.UserTyp = '2') // Gold
    or (DM.UserTyp = '3') // Platium
    or (DM.UserTyp = '4') // Gold & Host
    or (DM.UserTyp = '5') // Platium & Host
    or (DM.UserTyp = '6') // VM Gold
    or (DM.UserTyp = '7') // VM Platium }

            if (DM.UserTyp = '1') then
            begin
             NewHintText := ChatData.Name;
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Bronze Plus.'; // *SET* account here
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.bicon.Picture.Bitmap); // *SET* account icon here
            end;

            if (DM.UserTyp = '3') then
            begin
             NewHintText := ChatData.Name;
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Plus.'; // *SET* account here
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.plat.Picture.Bitmap); // *SET* account icon here
            end;

           // (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Plus Member.'; // *SET* account here
           // (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(Image1.Picture); // *SET* account icon here

            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;
            HintPosition.Right := HintPosition.Left + 100;
            HintPosition.Bottom := HintPosition.Top + 40;
// Show the hint window...
            HintWindow.ActivateHint(HintPosition, NewHintText);
            tHintTimer.Enabled := True; // turn on the timer that will close the hint
        end;
        HintText := NewHintText;
    end;
end;
0
 
TheRealLokiSenior DeveloperCommented:
hmm, are you using a virtualstringtree now. That might be the issue. I had it checking for virtualdrawtree
anyway, delete all of this code below :-


        if (Sender is TVirtualDrawTree) then
        begin
(*
            node := (Sender as TVirtualDrawTree).GetNodeAt(x, y);
            if node <> nil then
              NewHintText := 'above node: ' + inttostr(node.Index)
// Remove the next 2 lines - they are just for testing
            else
              NewHintText := Format('X = %d, Y = %d', [X, Y]);
*)
           // NewHintText := 'ChatData.Name'; // *SET* your ChatData.Name text here

            if (DM.UserTyp = '1') then
            begin
             NewHintText := ChatData.Name;
            end;

            if (DM.UserTyp = '3') then
            begin
             NewHintText := ChatData.Name;
            end;
        end;


*** and replace it with just

            if (DM.UserTyp = '1') then
            begin
             NewHintText := ChatData.Name;
            end;

            if (DM.UserTyp = '3') then
            begin
             NewHintText := ChatData.Name;
            end;
0
 
fiveukAuthor Commented:
am using Virtual Treeview by soft-gems and it still dont show the custom type of user is just shows everyone as Platium ( if (DM.UserTyp = '3') then  )
0
 
fiveukAuthor Commented:
ok I sorted it shows other accounts but still have the problem of auto resize I want it so it matches the size of the account label or username label so the name or account type allways fits the hint window and thanks for all the help there be 500 points heading your ways soon
0
 
fiveukAuthor Commented:
allso mate how can I place the image on top of a black panel like so


// add an image
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 20;
                    left := 4;
                    Transparent := false;
                    picture.assign(image1.Picture);
                    parent := hintwindow;
                    name := 'ExtraHintImage';
                end;

// add panel
                with TPanel.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 20;
                    left := 4;
                    Color := clBlack;
                    parent := hintwindow;
                   // name := 'ExtraHintPanel;
                end;
0
 
TheRealLokiSenior DeveloperCommented:
all the following code is necessary to make the hint the right size (depending if the hint text or the extra label is bigger
The code will also centre the "extra label" to the image.
add the new bits to your procedure, but ignore the *SET* parts that you are doing elsewhere


                with TLabel.create(HintWindow) do
                begin
                    width := 60;
                    height := 16;
                    top := 22;
                    left := 24; // this will get set later to be just past the image
//                    Caption := 'Plus member.';
                    transparent := true;
                    parent := hintwindow;
                    autosize := true; // so the label grows to the necessary size
                    name := 'ExtraHintLabel';;
                end;

// add an image to the hint :-)
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 20;
                    left := 4;
                    picture.assign(image1.Picture);
                    parent := hintwindow;
                    autosize := true; // if you want the image to grow to the actual size of the icon. Otherwise, set this to false if you always want it to be 16x16

                    name := 'ExtraHintImage';
                end;
// end of *NEW* stuff
            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

// *NEW*
// set up the custom data. ExtraHintLabel, image
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Plus Member.'; // *SET* account here
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(Image1.Picture); // *SET* account icon here
// place the extra text in the right place
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left := (HintWindow.FindComponent('ExtraHintImage') as TImage).Left +
              (HintWindow.FindComponent('ExtraHintImage') as TImage).Width + 4;
// centre the extra text to the middle "Y" of the image
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Top := (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
              ((HintWindow.FindComponent('ExtraHintImage') as TImage).Height div 2) - 8;

            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;

            HintPosition.Right := HintPosition.Left +
              Max( HintWindow.Canvas.TextWidth(NewHintText) + 4, // main hint text width
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left +
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Canvas.TextWidth((HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption)
              ) + 4;
            HintPosition.Bottom := HintPosition.Top +
              (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
              (HintWindow.FindComponent('ExtraHintImage') as TImage).Height + 4;
0
 
TheRealLokiSenior DeveloperCommented:
// add a black panel to the hint
                with TPanel.create(HintWindow) do
                begin
                    width := 30;
                    height := 16;
                    top := 4;
                    left := 60;
                    color := clblack;
                    parent := hintwindow;
                    name := 'ExtraHintPanel';
                end;
// add a label inside the black panel
                with TLabel.create(HintWindow) do
                begin
                    width := 20;
                    height := 15;
                    top := 2;
                    left := 2;
                    Font.Color := clYellow;
                    Caption := 'test';
                    transparent := true;
                    parent := (HintWindow.FindComponent('ExtraHintPanel') as TPanel); // this is the important bit
                    autosize := true; // so the label grows to the necessary size
                    name := 'ExtraHintLabelInsidePanel';
                end;


Since you're making so many of these, it might be easier to read if you had them as variables instead of doing the FindComponent. If you ghet time, you might like to tidy this up so it's nicer to look at

e.g.
var
    ExtraHintLabel: TLabel;
    ExtraHintImage: TImage;
beign

then we could just have done
EtraHintLabel := TLabel.Crate;
with ExtraHintLabel do
begin
...
end;

and further down, it would be
ExtraHintLabel.Left := ExtraHintImage.Left + ExtraHintImage.Width + 4;
a bit easier to read, but both methods will work fine
0
 
TheRealLokiSenior DeveloperCommented:
oh btw, for the "MAX()" function to need to add
"MATH" to your uses clause
e.g.
uses forms, windows....., math;
0
 
fiveukAuthor Commented:
HintPosition.Right := HintPosition.Left +
              Max( HintWindow.Canvas.TextWidth(NewHintText) + 4, // main hint text width
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left +
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Canvas.TextWidth((HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption)
              ) + 4;
            HintPosition.Bottom := HintPosition.Top +
              (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
              (HintWindow.FindComponent('ExtraHintImage') as TImage).Height + 4;

dont work I added the maths allso still no go it says MISSING OPERTATION OR SEMICONLON
0
 
fiveukAuthor Commented:
here my full code mate image still dont show over the panel :(


procedure TChatForm.VTSMouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
var
  node: PVirtualNode;
  NewHintText: string;
  ChatData: PIMData;
begin
   Node := VTS.GetNodeAt(X, Y);
if Node <> nil then
if UserTable.RecordCount > 0 then
begin
   ChatData := VTS.GetNodeData(Node);

 if HintText = '*CLOSING*' then
        begin
            HintText := '';
            exit;
        end;

        NewHintText := '';

        if (ChatData.Typ = '') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '0') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '1') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '2') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '3') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '4') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '5') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '6') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '7') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '8') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '9') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '10') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '11') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '12') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '13') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '14') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '15') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '16') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '17') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '18') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '19') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '20') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '21') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '22') then
        begin
           NewHintText := ChatData.Name;
        end;

        if NewHintText = '' then
        begin
// Hide the hint window...
            if assigned(HintWindow) then
            begin
                tHintTimer.Enabled := False;
// move the hint off screen to avoid the need for a repaint on the controls
                HintPosition.Left := Screen.Width + 10;
                HintPosition.Top := Screen.Height + 10;
// now get rid of it
                if assigned(HintWindow) then
                  FreeAndNil(HintWindow);
            end;
        end
        else if NewHintText <> HintText then
        begin
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
//*NEW*

// add some extra text
                with TLabel.create(HintWindow) do
                begin
                    width := 60;
                    height := 16;
                    top := 22;
                    left := 25;
//                  Caption := 'Plus member.';
                    transparent := true;
                    parent := hintwindow;
                    name := 'ExtraHintLabel';
                end;

// add an image to the hint :-)
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    top := 26;
                    left := 8;
                    picture.assign(image1.Picture);
                   // parent := hintwindow;
                    parent := (HintWindow.FindComponent('ExtraHintPanel') as TPanel); // this is the important bit
                    autosize := true; // if you want the image to grow to the actual size of the icon. Otherwise, set this to false if you always want it to be 16x16
                    Transparent := False;
                    name := 'ExtraHintImage';
                end;

// add a black panel to the hint
                with TPanel.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    BevelInner := bvLowered; // bvRaised, bvSpace, bvNone, bvLowered
                    BevelOuter := bvNone; // bvRaised, bvSpace, bvNone, bvLowered
                    BevelWidth := 1;
                    BorderStyle := bsNone; // bsSingle
                    top := 20;
                    left := 4;
                    color := clblack;
                    parent := hintwindow;
                    name := 'ExtraHintPanel';
                end;

// end of *NEW* stuff

            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

// *NEW*
// set up the custom data. ExtraHintLabel, image

        if (ChatData.Typ = '') then
        begin
           // none
        end;

        if (ChatData.Typ = '0') then
        begin
           // none
        end;

        if (ChatData.Typ = '1') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Bronze Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.bicon.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '2') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.gold.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '3') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.plat.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '4') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.gold.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '5') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.plat.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '6') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Value Member'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.vmg.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '7') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Value Member'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.vmp.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '8') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '9') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep1.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '10') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep2.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '11') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep3.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '12') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer Coordinator'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.repc.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '13') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := '5uk Employee'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.Admin.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '14') then
        begin
           // none
        end;

        if (ChatData.Typ = '15') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Commnunity Leader'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.cleader.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '16') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '17') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '18') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '19') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Event Host'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.eh.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '20') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Event Host Coordinator'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.ehc.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '21') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Booster'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.bosster.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '22') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Special Hat'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.tola.Picture.Bitmap); // *SET* account icon here
        end;

// place the extra text in the right place
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left := (HintWindow.FindComponent('ExtraHintImage') as TImage).Left +
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Width + 4;
// centre the extra text to the middle "Y" of the image
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Top := (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
           ((HintWindow.FindComponent('ExtraHintImage') as TImage).Height div 2) - 8;

   
// ALL THE CODE BELOW IS COMMENTED OUT AS IT DONT WORK!!!    

    { HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Y;

            HintPosition.Right := HintPosition.Left +
              Max(HintWindow.Canvas.TextWidth(NewHintText) + 4, // main hint text width
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left +
              (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Canvas.TextWidth((HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption)) + 4;
               HintPosition.Bottom := HintPosition.Top + (HintWindow.FindComponent('ExtraHintImage') as TImage).Top + (HintWindow.FindComponent('ExtraHintImage') as TImage).Height + 4; }

// END OF NONE WORKING CODE

            HintPosition.Left := Form1.Left + (Sender as TControl).Left + X + 30; //30 to put it just to the right of the cursor
            HintPosition.Top := Form1.Top + (Sender as TControl).Top + Mouse.CursorPos.Y; // same height as mouse
// HintPosition.Right := HintPosition.Left + 100; // width of hint box

            HintPosition.Right := HintPosition.Left + (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Width+Y; // width of hint box
            HintPosition.Bottom := HintPosition.Top + 39;  // height of hint box

// Show the hint window...
            HintWindow.ActivateHint(HintPosition, NewHintText);
            tHintTimer.Enabled := True; // turn on the timer that will close the hint
        end;
        HintText := NewHintText;
    end;
end;
0
 
TheRealLokiSenior DeveloperCommented:
just create the image _after_ you create the panel, not before as yor code above does
0
 
fiveukAuthor Commented:
hi mate got a other problem well two other problems really

first one is I want the two following accounts to only have there name as the hint with out the image or the panel or account info lable like others

        if (ChatData.Typ = '0') then
        begin
           // just show name as hint info with out image/panel/status text
        end;

        if (ChatData.Typ = '1') then
        begin
           // just show name as hint info with out image/panel/status text
        end;

and other problem is how can I add more then one image or info text to a hint i do a screen shot tomorrow for you and here my code is this all correct two you?

[code]
procedure TChatForm.VTSMouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
var
  node: PVirtualNode;
  NewHintText: string;
  ChatData: PIMData;
  ExtraHintLabel: TLabel;
  ExtraHintImage: TImage;
begin
   Node := VTS.GetNodeAt(X, Y);
if Node <> nil then
if UserTable.RecordCount > 0 then
begin
   ChatData := VTS.GetNodeData(Node);

 if HintText = '*CLOSING*' then
        begin
            HintText := '';
            exit;
        end;

        NewHintText := '';

        if (ChatData.Typ = '') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '0') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '1') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '2') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '3') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '4') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '5') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '6') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '7') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '8') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '9') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '10') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '11') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '12') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '13') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '14') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '15') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '16') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '17') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '18') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '19') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '20') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '21') then
        begin
           NewHintText := ChatData.Name;
        end;

        if (ChatData.Typ = '22') then
        begin
           NewHintText := ChatData.Name;
        end;

        if NewHintText = '' then
        begin
// Hide the hint window...
            if assigned(HintWindow) then
            begin
                tHintTimer.Enabled := False;
// move the hint off screen to avoid the need for a repaint on the controls
                HintPosition.Left := Screen.Width + 10;
                HintPosition.Top := Screen.Height + 10;
// now get rid of it
                if assigned(HintWindow) then
                  FreeAndNil(HintWindow);
            end;
        end
        else if NewHintText <> HintText then
        begin
// Set up the Hint Window
            if not assigned(HintWindow) then
            begin
                HintWindow := THintWindow.Create(Sender as TControl);
                HintWindow.Parent := (Sender as TWinControl);
//*NEW*

// add a black panel to the hint
                with TPanel.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                    BevelInner := bvLowered; // bvRaised, bvSpace, bvNone, bvLowered
                    BevelOuter := bvNone; // bvRaised, bvSpace, bvNone, bvLowered
                    BevelWidth := 1;
                    BorderStyle := bsNone; // bsSingle
                    top := 20;
                    left := 4;
                    color := clblack;
                    parent := hintwindow;
                    name := 'ExtraHintPanel';
                end;

// add an image to the hint :-)
                with TImage.create(HintWindow) do
                begin
                    width := 16;
                    height := 16;
                   // top := 1;
                   // left := 1;
                    picture.assign(image1.Picture);
                    // parent := hintwindow;
                    parent := (HintWindow.FindComponent('ExtraHintPanel') as TPanel); // this is the important bit
                    autosize := true; // if you want the image to grow to the actual size of the icon. Otherwise, set this to false if you always want it to be 16x16
                    Transparent := True;
                    name := 'ExtraHintImage';
                end;

// add some extra text
                with TLabel.create(HintWindow) do
                begin
                    top := 20;
                    left := 4;
                    Transparent := True;
                    Autosize := True;
                    parent := hintwindow;
                    name := 'ExtraHintLabel';
                end;

// end of *NEW* stuff

            end;
            HintWindow.Font.Color := GetSysColor(COLOR_INFOTEXT);
            HintWindow.Color := GetSysColor(COLOR_INFOBK);

// *NEW*
// set up the custom data. ExtraHintLabel, image

        if (ChatData.Typ = '') then
        begin
           // none
        end;

        if (ChatData.Typ = '0') then
        begin
           // none
        end;

        if (ChatData.Typ = '1') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Bronze Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.bicon.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '2') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.gold.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '3') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.plat.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '4') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.gold.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '5') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Plus'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.plat.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '6') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Gold Value Member'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.vmg.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '7') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Platium Value Member'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.vmp.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '8') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '9') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep1.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '10') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep2.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '11') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.rep3.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '12') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Volunteer Coordinator'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.repc.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '13') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := '5uk Employee'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.Admin.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '14') then
        begin
           // none
        end;

        if (ChatData.Typ = '15') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Commnunity Leader'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.cleader.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '16') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '17') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '18') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Trophy Winner'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.winner.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '19') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Event Host'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.eh.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '20') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Event Host Coordinator'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.ehc.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '21') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Booster'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.bosster.Picture.Bitmap); // *SET* account icon here
        end;

        if (ChatData.Typ = '22') then
        begin
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption := 'Special Hat'; // *SET* account here
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Picture.Assign(ResForm.tola.Picture.Bitmap); // *SET* account icon here
        end;

// place the extra text in the right place
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left :=
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Left +
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Width + 6;  // 4

// centre the extra text to the middle "Y" of the image
           (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Top :=
           (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
           ((HintWindow.FindComponent('ExtraHintImage') as TImage).Height div 2) + 11; //8

           HintPosition.Left := Mouse.CursorPos.X; // gets cursor point
           HintPosition.Top := Mouse.CursorPos.Y;

           HintPosition.Right := HintPosition.Left +
          // Max(HintWindow.Canvas.TextWidth(NewHintText) := 4) // main hint text width
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Left +
            (HintWindow.FindComponent('ExtraHintLabel') as TLabel).Canvas.TextWidth((HintWindow.FindComponent('ExtraHintLabel') as TLabel).Caption) + 4; // width of hint box

           HintPosition.Bottom := HintPosition.Top +
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Top +
            (HintWindow.FindComponent('ExtraHintImage') as TImage).Height + 21;  // height of hint box

// Show the hint window...
            HintWindow.ActivateHint(HintPosition, NewHintText);
            tHintTimer.Enabled := True; // turn on the timer that will close the hint
        end;
        HintText := NewHintText;
    end;
[/code]

p.s I send you the ftp info for source tomorrow and I use delphi 7 enterprise is that ok???
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 14
  • 12
Tackle projects and never again get stuck behind a technical roadblock.
Join Now