From: George J <ivanov_george@list.ru>
Subject: GNAVI,GWindows.Common_Controls.On_Notify - how to return value?
Date: Sat, 13 Aug 2016 02:27:03 -0700 (PDT)
Date: 2016-08-13T02:27:03-07:00 [thread overview]
Message-ID: <d7fcad78-8960-4724-97e3-713a3760b3c7@googlegroups.com> (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!
next reply other threads:[~2016-08-13 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-13 9:27 George J [this message]
2016-08-14 7:12 ` GNAVI,GWindows.Common_Controls.On_Notify - how to return value? gautier_niouzes
2016-08-14 15:04 ` George J
2016-08-15 10:02 ` gautier_niouzes
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox