Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

different HintPopupTime in same application

Posted on 2003-12-02
5
Medium Priority
?
198 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

688 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