Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages
Started by pera
Fri, 04 Apr 2003 16:43
create event for double click between column header of listview?
Author: pera
Date: Fri, 04 Apr 2003 16:43
Date: Fri, 04 Apr 2003 16:43
8 lines
1172 bytes
1172 bytes
Hi Is there a way of getting the message for the double click between the header columns of a listview. The reason is that i need to call ListView->Refresh when the user is "resizing the column width" by double clicking between the column headers. ;)
Re: create event for double click between column header of listview?
Author: Remy Lebeau (TeamB)
Date: Fri, 04 Apr 2003 17:41
Date: Fri, 04 Apr 2003 17:41
21 lines
1795 bytes
1795 bytes
"pera" <picka2@gmx.net> wrote in message news:3e8db610$1@newsgroups.borland.com... > Is there a way of getting the message for the double click > between the header columns of a listview. TListView itself does not expose that event. You will have to subclass the ListView in order to intercept the WM_NOTIFY message manually, testing for the HDN_DIVIDERDBLCLICK (and optionally HDN_BEGINTRACK) notification. > The reason is that i need to call ListView->Refresh when > the user is "resizing the column width" by double clicking > between the column headers. If a column resizes, the ListView should already be refreshing itself automatically, but apparently it only does that if the ListView is owner-drawn. Gambit
Re: create event for double click between column header of listview?
Author: pera
Date: Fri, 04 Apr 2003 18:21
Date: Fri, 04 Apr 2003 18:21
14 lines
1366 bytes
1366 bytes
Hi
Even if i am going to subclass the listview to get to the header message,
how do i get the resize execution bevor my listview->refresh()
something i tried but not worked the way i thought:
void __fastcall TForm1::MyOnMessage(MSG& Msg, bool& Handled)
{
if (Msg.message == WM_LBUTTONDBLCLK)
if (ListView->Focused())
ListView->Refresh();
}
Re: create event for double click between column header of listview?
Author: Remy Lebeau (TeamB)
Date: Fri, 04 Apr 2003 19:19
Date: Fri, 04 Apr 2003 19:19
51 lines
2573 bytes
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
Re: create event for double click between column header of listview?
Author: pera
Date: Fri, 04 Apr 2003 22:39
Date: Fri, 04 Apr 2003 22:39
62 lines
2882 bytes
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
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads