🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#17357
From: Remy Lebeau (TeamB)
Date: Fri, 04 Apr 2003 19:19
51 lines
2573 bytes
"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: <3e8ddac0$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!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>

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 11:24:08 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3e8db610$1@newsgroups.borland.com> <3e8dc3d3$1@newsgroups.borland.com> <3e8dcd32$1@newsgroups.borland.com>
Subject: Re: create event for double click between column header of listview?
Date: Fri, 4 Apr 2003 11:19:38 -0800
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3e8ddac0$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1049483968 207.175.226.26 (4 Apr 2003 11:19:28 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail