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 capture the WM_CUT, WM_CLEAR and WM_PASTE messages in a TComboBox 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
27-Aug-02
Category
VCL-General
Language
Delphi 2.x
Views
131
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

By hooking into the WndProc I can listen to the messages generated for 
TWinControls. I am looking for the WN_CUT, WM_PASTE and WM_CLEAR so that I can lock 
a record before the cut, paste or clear change occurs. The TComboBox does not 
generate these events when the Style is csDropDown. Any way to capture these events?

Answer:

Override the ComboWndProc method ín a class derived from TCombobox. Example:

1   unit Unit1;
2   
3   interface
4   
5   uses
6     Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7     Dialogs, StdCtrls;
8   
9   type
10    TCombobox = class(stdctrls.TComboBox)
11    protected
12      procedure ComboWndProc(var message: TMessage; ComboWnd: HWnd;
13        ComboProc: Pointer); override;
14    end;
15    TForm1 = class(TForm)
16      ComboBox1: TComboBox;
17      Memo1: TMemo;
18    private
19      { Private declarations }
20    public
21      { Public declarations }
22    end;
23  
24  var
25    Form1: TForm1;
26  
27  implementation
28  
29  {$R *.dfm}
30  
31  { TCombobox }
32  
33  procedure Report(const S: string);
34  begin
35    form1.memo1.lines.add(S);
36  end;
37  
38  procedure TCombobox.ComboWndProc(var message: TMessage; ComboWnd: HWnd;
39    ComboProc: Pointer);
40  begin
41    inherited;
42    case message.Msg of
43      WM_CUT: Report('CUT');
44      WM_PASTE: Report('PASTE');
45      WM_CLEAR: Report('CLEAR');
46    end;
47  end;
48  
49  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