Solved

different HintPopupTime in same application

Posted on 2003-12-02
5
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month11 days, 12 hours left to enroll

623 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