Notify Event for own Control

Notify Event for own Control

Postby Jimmy » Mon Oct 17, 2022 5:55 am

hi,

for my CLASS TGrid i like to receive Notify Event when fired for LVN_GETDISPINFO

---

when use CLASS ActiveX i can use Codeblock Slot bOnEvent
Code: Select all  Expand view
  ::oControl:bOnEvent := { | cEvent, aParams | ::VLC_Event( cEvent, aParams ) }

it is called in METHOD OnEvent() CLASS TActiveX

---

how can i use this Concept in my own Class TGrid under FiveWin :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Notify Event for own Control

Postby Antonio Linares » Mon Oct 17, 2022 6:40 am

Dear Jimmy,

Please post here the code of your Class TGrid so we can review it and help you, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Notify Event for own Control

Postby Jimmy » Mon Oct 17, 2022 7:50 am

hi Antonio,

i have no (working) Code yet, just begin to build Method and HB_FUNC()

---

i have from TLISTVIE.PRG
Code: Select all  Expand view
METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TListView
local nOption
local nCode       := GetNMHDRCode( nPtrNMHDR )

   do case
      case nCode == NM_CLICK
        ...
      case nCode == LVN_ITEMCHANGED
        ...
      case nCode == LVN_GETDISPINFO   // add here ?
 

do i add LVN_GETDISPINFO here :?:

---

Listview can use "Single" API Call
Code: Select all  Expand view
   Listview_InsertItem()

for each Row or "just" assign hole Array and use Notify Event when set LVN_GETDISPINFO

this is my Xbase++ using OT4XB Syntax

Code: Select all  Expand view
// create Notify Event to send UserDef Event xbeMyLv_DISPINFO
   ::SetLvNotifyCB( LVN_GETDISPINFO  , ;
     { | xbp, code, lp, st | st := NMLVDISPINFO():New(), st:_write_( lp, 0, - 1 ), ;
     PostAppEvent(xbeMyLv_DISPINFO, st:item, st, Self ), NIL } )


Code: Select all  Expand view
INLINE METHOD SetLvNotifyCB( notify_code , b )
       local k,r
       local np  := PCount()
       if Valtype(notify_code) != "N" ; return NIL ; end
       k := cPrintf("LV%08.8X.notify",notify_code)
       r := delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_GetProp(::m_ht,k)) } )
       if np > 1
          if Valtype(b) == "B"
             delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_SetProp(::m_ht,k,b)) } )
          else
             delegated_eval( {|| iif( ::m_ht == NIL,, _hdict_RemoveProp(::m_ht,k)) } )
          end
       end
       return r

Code: Select all  Expand view
// will be activate when get WM_NOTIFY
INLINE METHOD xbp_wndproc(hWnd,nMsg,wp,lp,ctx)
   ...
    elseif nMsg == WM_NOTIFY
       if lp == 0 ; return NIL ; end // must not happen
       if( PeekDWord(lp) == ::hLv ) // hLv Handle of Listview
         return ::_HandleListViewNotify_( PeekDWord(lp,8) , lp )
       end
       return NIL


Code: Select all  Expand view
// will EVAL() Codeblock
INLINE METHOD _HandleListViewNotify_( notify_code , p ) // do not call outside GUI thread
local b := iif( ::m_ht==NIL,NIL, _hdict_getprop(::m_ht, cPrintf("LV%08.8X.notify",notify_code)) )
   if Valtype(b) =="B"
      return Eval(b, Self , notify_code , p )
   end
return NIL
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Notify Event for own Control

Postby Antonio Linares » Mon Oct 17, 2022 10:34 am

Dear Jimmy,

> do i add LVN_GETDISPINFO here ?

yes, that is fine
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Notify Event for own Control

Postby Jimmy » Tue Oct 18, 2022 11:27 pm

to use Notify Event LVN_GETDISPINFO i need Structure LV_DISPINFO (NMLVDISPINFO) and lParam

i have found
Code: Select all  Expand view
GetLParam( nPtrNMHDR )

and try to use it in METHOD Notify() but i only got 0 (zero)

Code: Select all  Expand view
METHOD Notify( nIdCtrl, nPtrNMHDR ) CLASS TGrid
LOCAL nOption
LOCAL nCode   := GetNMHDRCode( nPtrNMHDR )
local nLPar   := GetLParam(    nPtrNMHDR )

   DO CASE
      CASE nCode == NM_CLICK
           ...
      CASE nCode == LVN_ITEMCHANGED
           ...
      CASE nCode == LVN_GETDISPINFO
         IF ::bDisplay != nil
            msgInfo(VAR2CHAR(nLPar),"LVN_GETDISPINFO")
            EVAL( ::bDisplay, nLPar, Self )
         ENDIF
 

so how use LParam for Notify Event LVN_GETDISPINFO :idea:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 71 guests