🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #17358

Re: create event for double click between column header of listview?

#17358
From: pera
Date: Fri, 04 Apr 2003 22:39
62 lines
2882 bytes
hi

works like a charme,
many thanks!

"Remy Lebeau (TeamB)" <gambit47@yahoo.com> schrieb im Newsbeitrag
news:3e8ddac0$1@newsgroups.borland.com...
>
> "pera" <picka2@gmx.net> wrote in message
> news:3e8dcd32$1@newsgroups.borland.com...
>
> > void __fastcall TForm1::MyOnMessage(MSG& Msg, bool& Handled)
>
> That suggests you're using the TApplication::OnMessage event.  If so, then
> that is not the correct place to intercept the message in this situation.
> As stated earlier, you need to subclass the ListView *directly*, and then
> intercept WM_NOTIFY, not WM_LBUTTONDBLCLK.  A ListView control has a very
> specific notification that is triggered when double-clicking on the
dividers
> of the header control.
>
> This is a snippet of code I use in my own project:
>
>     TWndMethod OldListViewProc;
>
>     __fastcall TForm1::TForm1(TComponent *Owner)
>         : TForm(Owner)
>     {
>         OldListViewProc = ListView1->WindowProc;
>         ListView1->WindowProc = ListViewWindowProc;
>     }
>
>     void __fastcall TForm1::ListViewWindowProc(TMessage &Msg)
>     {
>         if( Msg.Msg == WM_NOTIFY )
>         {
>             const NMHDR *pnmh = (NMHDR*)Msg.LParam;
>             if((pnmh->code == HDN_BEGINTRACKA) || (pnmh->code ==
> HDN_BEGINTRACKW) ||
>                 (pnmh->code == HDN_DIVIDERDBLCLICKA) || (pnmh->code ==
> HDN_DIVIDERDBLCLICKW))
>             {
>                 // do something
>
>                 // if you want to swallow the message from being handled
any
> further:
>                 if( swallow the message )
>                 {
>                     Msg.Result = TRUE;
>                     return;
>                 }
>             }
>         }
>
>         OldListViewProc(Msg);
>     }
>
>
> Gambit
>
>
Technical Details
Message-ID: <3e8e097e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3e8db610$1@newsgroups.borland.com> <3e8dc3d3$1@newsgroups.borland.com> <3e8dcd32$1@newsgroups.borland.com> <3e8ddac0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d949ecb86650b21
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-04-04 14:43:13 PST
From: "pera" <picka2@gmx.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e8db610$1@newsgroups.borland.com> <3e8dc3d3$1@newsgroups.borland.com> <3e8dcd32$1@newsgroups.borland.com> <3e8ddac0$1@newsgroups.borland.com>
Subject: Re: create event for double click between column header of listview?
Date: Sat, 5 Apr 2003 00:39:09 +0200
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 212.186.101.20
Message-ID: <3e8e097e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049495934 212.186.101.20 (4 Apr 2003 14:38:54 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail