Solved

different HintPopupTime in same application

Posted on 2003-12-02
5
192 Views
Last Modified: 2010-07-27
Hi Experts,

I have 2 buttons on the form. I want Hint popup over first button lasted for 1 sec, but over the second button it  lasted, say, 5 sec. Q. Is it possible to have several different HintPopupTime's in same application?

Sincerely,
odissey1
0
Comment
Question by:odissey1
  • 3
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9865133
simplest sample

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Button2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  application.HintPause := 1000; //1 sec
end;

procedure TForm1.Button2MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  application.HintPause := 5000; //5 sec
end;

end.

meikl ;-)
0
 
LVL 2

Author Comment

by:odissey1
ID: 9868759
Hi kretzschmar,

Thank you for attention.
There is a trick in the question. I know that Delphi does not support multiple hint popup times. Two buttons, of course is just an example. In real application there are dozens of controls. Going this way I have to put MouseMove event into every control in the Application - not good. We can use mouseEnter/MouseLeave events for some particular control to set it specific HintPause, but I figured MouseLeave event is not fired always (try to move mouse fast).

So I am looking for some general idea here.

Sincerely,
odissey1
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9868980
well,

i will take a look to the onHint-event of the application (not sure if it works),
you could use a tlist as container for the needed control-reference

will try a sample tomorrow

meikl ;-)
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 9873433
what about this?
(the hinttime is stored in the tag-property of the tcontrol)


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, AppEvnts, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    ApplicationEvents1: TApplicationEvents;
    procedure ApplicationEvents1ShowHint(var HintStr: String;
      var CanShow: Boolean; var HintInfo: THintInfo);
  private
    FLastHint : THintInfo;  // you may also use only a TControl as refeernce
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ApplicationEvents1ShowHint(var HintStr: String;
  var CanShow: Boolean; var HintInfo: THintInfo);
begin
  CanShow := HintInfo.HintControl = FLastHint.HintControl;
  if not CanShow then
  begin
    HintInfo.ReshowTimeout := HintInfo.HintControl.Tag;
    FLastHint := HintInfo;
  end
  else
    FLastHint.HintControl := Nil;
end;

end.

meikl ;-)
0
 
LVL 2

Author Comment

by:odissey1
ID: 9880360
Hi  kretzschmar,

Thank you for help. I like your approach. I will try to utilyze not Tag's (they are already used in my application for other things), but  instead I  will try to encode ReshowTimeout into Hint string itself, like: 'This is a hint |1000' and extract all stuff on-the-fly.

Sincerely,
odissey1
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now