ENTER for TGrid From TControl

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

ENTER for TGrid From TControl

Post by Jimmy »

hi,

i can use Method Notify() to get NM_CLICK but how when press ENTER of Listview :?:

Code: Select all | Expand

METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TGrid
LOCAL nCode   := GetNMHDRCode( nPtrNMHDR )
LOCAL nWParam := GetWParam(    nPtrNMHDR )
LOCAL nLParam := GetLParam(    nPtrNMHDR )

   CASE nCode == LVN_KEYDOWN
      if GETGRIDVKEY(nLParam) = 13

but it crash here :(

Code: Select all | Expand

HB_FUNC ( GETGRIDVKEY )
{
   #ifndef _WIN64
      LPARAM lParam = (LPARAM) hb_parnl (1);
   #else
      LPARAM lParam = (LPARAM) hb_parnll (1);
   #endif
   LV_KEYDOWN * LVK = (LV_KEYDOWN *) lParam;
   hb_retni ( LVK->wVKey );
}

i "think" i got wrong nLParam from GetLParam(nPtrNMHDR) ..

so how to ENTER my CLASS TGrid :idea:
greeting,
Jimmy
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: ENTER for TGrid From TControl

Post by Jimmy »

hi,

got it :D

Code: Select all | Expand

CASE nCode == LVN_KEYDOWN
   // nOption = Get_NMListViewItem( nPtrNMHDR ) + 1
   nKey := GETGRIDVKEY(nPtrNMHDR)
   onDummy( TIME(), "LVN_KEYDOWN",nKey, ::nOption )
   IF nKey = 13
      IF ::bClick != nil
         // ::nOption := nOption
         //  use last from LVN_ITEMCHANGED
         EVAL( ::bClick, ::nOption, Self )
      ENDIF
   ENDIF

instead of nLParam i have to use nPtrNMHDR
greeting,
Jimmy
User avatar
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: ENTER for TGrid From TControl

Post by Antonio Linares »

You are improving everyday my friend :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply