[DUG] Stringgrid - intercepting keys

Edward Koryagin ed_iv2001 at yahoo.co.nz
Mon Oct 5 20:32:23 NZDT 2009


WinProc?
Edward Koryagin


--- On Mon, 5/10/09, John Bird <johnkbird at paradise.net.nz> wrote:

> From: John Bird <johnkbird at paradise.net.nz>
> Subject: [DUG]  Stringgrid - intercepting keys
> To: "NZ Borland Developers Group - Delphi List" <delphi at delphi.org.nz>
> Received: Monday, 5 October, 2009, 5:25 PM
> For a long time I have been
> intercepting keys such as Escape/Enter/Tab no 
> problem
> 
> I have been wanting to put a simple search facility in a
> string grid, and 
> would like to intercept Ctrl/F and F3.....but the code as I
> am using does 
> not get them (D2007) - they are just ignored.
> 
> Looks like the only characters I can intercept are Tab,
> Enter and Escape...
> 
> Any suggestions?
> 
> 
> procedure TfrmTimeSh2.CMDialogKey(var Msg: TWMKEY);
> {
>    This converts ENTER key messages to TAB
> key messages, provided a few
>    conditions hold
> }
> begin
>    if   (ActiveControl is
> TCustomEdit)
>     or (ActiveControl is TStringGrid)
>    then
>      begin
>        ATPKeyDir:='';
>        if Msg.CharCode = VK_RETURN
> then
>        begin
>          Msg.CharCode :=
> VK_TAB;
>          ATPKeyDir:='Next';
>        end;
>        if Msg.Charcode = VK_ESCAPE
> then
>        begin
>          Msg.CharCode :=
> VK_TAB;
>          ATPKeyDir:='Prev';
>        end;
>        if Msg.Charcode = VK_F2
> then               
>             <=== 
> never 
> intercepted
>        begin
>      
>    xcGridFind((ActiveControl as
> TStringGrid),FindStr,strFound);
>        end;
>        if Msg.Charcode = VK_F3
> then             
> <===  never intercepted
>        begin
>      
>    xcGridFindNext((ActiveControl as
> TStringGrid),FindStr,strFound);
>        end;
>      end;
>    inherited;
> end;
> 
> 
> John 
> 
> 
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz
> with Subject: unsubscribe
> 


      



More information about the Delphi mailing list