From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.145.103 with SMTP id st7mr13612685pab.0.1471080423514; Sat, 13 Aug 2016 02:27:03 -0700 (PDT) X-Received: by 10.157.17.86 with SMTP id p22mr931867otp.9.1471080423469; Sat, 13 Aug 2016 02:27:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no9587109ith.0!news-out.google.com!d68ni26101ith.0!nntp.google.com!f6no9587098ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 13 Aug 2016 02:27:03 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=109.252.108.27; posting-account=YB4WOgoAAABLG9D7qoJiPBc6EJSzsPDF NNTP-Posting-Host: 109.252.108.27 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: GNAVI,GWindows.Common_Controls.On_Notify - how to return value? From: George J Injection-Date: Sat, 13 Aug 2016 09:27:03 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31424 Date: 2016-08-13T02:27:03-07:00 List-Id: 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!