Solved

different HintPopupTime in same application

Posted on 2003-12-02
5
193 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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