Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to show a hint window programmatically Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
Others
Language
Delphi 2.x
Views
94
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

Is there any API call, Delphi function or trick to show a hint window manually?

Answer:

This should get you started:

1   unit HintSelfNoTimer;
2   
3   interface
4   
5   uses
6     Windows, SysUtils, Messages, Classes, Graphics, Controls, Forms, Dialogs, 
7   StdCtrls, ExtCtrls;
8   
9   const
10    UM_EXITPROC = WM_USER + 42;
11  
12  type
13    TFrmHintSelfNoTimer = class(TForm)
14      ComboBox1: TComboBox;
15      Edit1: TEdit;
16      procedure Edit1Exit(Sender: TObject);
17      procedure FormCreate(Sender: TObject);
18      procedure Edit1KeyPress(Sender: TObject; var Key: Char);
19    private
20      FActive: boolean;
21      FHint: THintWindow;
22      procedure AppMessage(var AMessage: TMsg; var Handled: Boolean);
23      procedure UMExitProc(var TheMsg: TMessage); message UM_EXITPROC;
24      procedure KillHint;
25    public
26    end;
27  
28  var
29    FrmHintSelfNoTimer: TFrmHintSelfNoTimer;
30  
31  implementation
32  
33  {$R *.DFM}
34  
35  procedure TFrmHintSelfNoTimer.AppMessage(var AMessage: TMsg; var Handled: Boolean);
36  begin
37    if (AMessage.message = WM_LBUTTONDOWN) or
38      (AMessage.message = WM_RBUTTONDOWN) then
39      if Assigned(FHint) and FHint.Visible then
40        KillHint;
41  end;
42  
43  procedure TFrmHintSelfNoTimer.UMExitProc(var TheMsg: TMessage);
44  begin
45    Edit1.SetFocus;
46  end;
47  
48  procedure TFrmHintSelfNoTimer.KillHint;
49  begin
50    FActive := false;
51    if Assigned(FHint) then
52    begin
53      FHint.ReleaseHandle;
54      FHint.Free;
55      FHint := nil;
56    end;
57  end;
58  
59  procedure TFrmHintSelfNoTimer.Edit1Exit(Sender: TObject);
60  var
61    thePoint: TPoint;
62    theRect: TRect;
63    theString: string;
64  begin
65    if Edit1.Text <> '42' then
66    begin
67      thePoint.X := Edit1.Left;
68      thePoint.Y := Edit1.Top - 24;
69      with theRect do
70      begin
71        topLeft := ClientToScreen(thePoint);
72        Right := Left + 150;
73        Bottom := Top + 18;
74      end;
75      theString := 'The answer is 42 y''know!';
76      FHint := THintWindow.Create(self);
77      FHint.ActivateHint(theRect, theString);
78      FActive := true;
79      PostMessage(Handle, UM_EXITPROC, 0, 0);
80    end;
81  end;
82  
83  procedure TFrmHintSelfNoTimer.FormCreate(Sender: TObject);
84  begin
85    Application.OnMessage := AppMessage;
86  end;
87  
88  procedure TFrmHintSelfNoTimer.Edit1KeyPress(Sender: TObject; var Key: Char);
89  begin
90    if Assigned(FHint) and FHint.Visible then
91      KillHint;
92  end;
93  
94  end.


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC