comp.lang.ada
 help / color / mirror / Atom feed
* GNAVI,GWindows.Common_Controls.On_Notify - how to return value?
@ 2016-08-13  9:27 George J
  2016-08-14  7:12 ` gautier_niouzes
  0 siblings, 1 reply; 4+ messages in thread
From: George J @ 2016-08-13  9:27 UTC (permalink / raw)


Hi all! Today I've got troubles with WM_NOTIFY message in Gwindows. I have a listview and i want to realize custom draw method (put progressbar in the cell and change font color) like in this little example (copied from codeproject examples):
-----------------------------
static LRESULT CALLBACK
MainWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg) {
        case WM_NOTIFY:
        {
            NMHDR* pHdr = (NMHDR*) lParam;
            if(pHdr->idFrom == ID_LISTVIEW  &&  pHdr->code == NM_CUSTOMDRAW)
           {
                NMLVCUSTOMDRAW* pcd = (NMLVCUSTOMDRAW*) lParam;

                   TCHAR buffer[16];
                   LVITEM item;
                   switch(pcd->nmcd.dwDrawStage) {
                      case CDDS_PREPAINT:
                          /* Tell the control we are interested in per-item notifications.
                          * (We need it just to tell the control we want per-subitem
                          * notifications.) */
                            return CDRF_DODEFAULT | CDRF_NOTIFYITEMDRAW;//  ^*^ Problem here!
.....etc
---------------------------------------------
I made overriding On_Notify method to listview (like in 24 tutorial example GWindows) :
-------------------------------------------
   type NMHDR is
      record
         HWND_From : Win32.Windef.HWND;
         ID_From   : Win32.UINT_PTR;
         Code      : Win32.UINT;
      end record;
   pragma Convention(C_PASS_BY_COPY,NMHDR);

   type LPNMHDR is access all NMHDR;
   -- ... and other declarations

   NM_FIRST      : constant := 0;
   NM_CUSTOMDRAW : constant := NM_FIRST-12;
   
   function To_LPNMHDR is new Ada.Unchecked_Conversion(GWindows.Types.Lresult,LPNMHDR);
   
   -- On_Notify --

   overriding procedure On_Notify
     (Window       : in out X_List_View_Type;
      Message      : in     GWindows.Base.Pointer_To_Notification;
      Control      : in     GWindows.Base.Pointer_To_Base_Window_Class;
      Return_Value : in out GWindows.Types.Lresult)
   is
      PNMHDR : LPNMHDR := To_LPNMHDR(Return_Value);
   begin
      case Message.Code is
         when NM_CUSTOMDRAW =>
            null;-- ^*^ i can't understand, how can i return CDRF_DODEFAULT here
         when others =>
            null;
      end case;
   end On_Notify;
--------------------------------------------
Can smb explain some mechanizm of On_Notify? I've explored GWindows sources and didn't find neither registering class, nor wndProc and really can't understand how to realize those C example. Thanks!


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAVI,GWindows.Common_Controls.On_Notify - how to return value?
  2016-08-13  9:27 GNAVI,GWindows.Common_Controls.On_Notify - how to return value? George J
@ 2016-08-14  7:12 ` gautier_niouzes
  2016-08-14 15:04   ` George J
  0 siblings, 1 reply; 4+ messages in thread
From: gautier_niouzes @ 2016-08-14  7:12 UTC (permalink / raw)


Hi George,
Have a look at On_Notify in GWindows.Common_Controls.Ex_List_View
(file .\gwindows\contrib\gwindows-common_controls-ex_list_view.adb ).
I guess it is the kind of things you'd like to do.
BTW Ex_List_View is a very cool customization of List_View's.
If you start the gwindows_contrib.gpr you can build 3 demos.
HTH
_________________________ 
Gautier's Ada programming 
http://sf.net/users/gdemont/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAVI,GWindows.Common_Controls.On_Notify - how to return value?
  2016-08-14  7:12 ` gautier_niouzes
@ 2016-08-14 15:04   ` George J
  2016-08-15 10:02     ` gautier_niouzes
  0 siblings, 1 reply; 4+ messages in thread
From: George J @ 2016-08-14 15:04 UTC (permalink / raw)


воскресенье, 14 августа 2016 г., 10:12:13 UTC+3 пользователь gautier...@hotmail.com написал:
> Hi George,
> Have a look at On_Notify in GWindows.Common_Controls.Ex_List_View
> (file .\gwindows\contrib\gwindows-common_controls-ex_list_view.adb ).
> I guess it is the kind of things you'd like to do.
> BTW Ex_List_View is a very cool customization of List_View's.
> If you start the gwindows_contrib.gpr you can build 3 demos.
> HTH
> _________________________ 
> Gautier's Ada programming 
> http://sf.net/users/gdemont/

Yes,Gautier!Thanks!It seems i've got - i have to put return value into Return_Value of On_Notify and return. I'll try it!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GNAVI,GWindows.Common_Controls.On_Notify - how to return value?
  2016-08-14 15:04   ` George J
@ 2016-08-15 10:02     ` gautier_niouzes
  0 siblings, 0 replies; 4+ messages in thread
From: gautier_niouzes @ 2016-08-15 10:02 UTC (permalink / raw)


BTW, if you have more questions, you may consider the GNAVI mailing list:
https://lists.sourceforge.net/lists/listinfo/gnavi-discuss
G.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-15 10:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-13  9:27 GNAVI,GWindows.Common_Controls.On_Notify - how to return value? George J
2016-08-14  7:12 ` gautier_niouzes
2016-08-14 15:04   ` George J
2016-08-15 10:02     ` gautier_niouzes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox