| View previous topic :: View next topic |
| Author |
Message |
trapper Contributor


Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Tue Feb 01, 2005 11:24 pm Post subject: How to generate a Click Event on a Table Column header? |
|
|
Is it possible to generate a CLICK event on a Table column header?
If I add the style COLUMNSORT the column headers become clickable but all the sorting is handled internally by Windows... is there some way I can know when a particular Column heading has been clicked?
I've thought of checking @mousepos() in relation to @dlgpos() but how do I know when a mouse button has been clicked?
Thanks.
EDIT: Just had a thought... perhaps the above in conjunction with a timer event and @mousedown ??? _________________ John Trappett |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Fri Mar 30, 2007 6:45 pm Post subject: |
|
|
| Did anyone ever find a way to detect a Column Header Click? |
|
| Back to top |
|
 |
uvedese Contributor


Joined: 21 Jan 2006 Posts: 169 Location: Spain
|
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Mar 31, 2007 2:05 pm Post subject: |
|
|
This works good for detecting a mouse click within the dialog but I need to know how to detect a Table Element Column Header click and which Column Header was clicked.
I suppose using your code as a base I could test for the coordinates clicked. However, with the Table Element the column order and width are not always static. |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sat Mar 31, 2007 4:14 pm Post subject: |
|
|
Aslan,
The Table element sends a LVN_COLUMNCLICK message to the main window. However I know of no way to handle this message with VDS. Take a look here for more information. You would need a DLL to subclass the Main dialog and handle this message explictly. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sat Mar 31, 2007 6:54 pm Post subject: |
|
|
I was going to try that with "Option MSGEVENT" but it seems that VDS can't handle negative message numbers.
Thanks for the reply on this and my VDS Bug post.
The HEX idea didn't work either
I guess I'll have to put this one on my GadgetX list
My guess is that even if "Option MSGEVENT" worked with this I would then have to handle all CLICK events for the Table. |
|
| Back to top |
|
 |
trapper Contributor


Joined: 28 Jan 2005 Posts: 112 Location: Brisbane, Australia
|
Posted: Sat Mar 31, 2007 9:55 pm Post subject: |
|
|
I'd already solved this (at least for my needs) back in early 2005 by using a TIMER event.
| Code: | # If left mouse button down
if @unequal(@lib(user32,GetAsyncKeyState,INT:,$01),0)
# Get effective column 1 width ie. width - cursor crosshair width (crosshairs for column width change)
%C = @diff(@sendmsg(@winexists(~TABLE1),@sum($1000,29),0,0),10)
# Get effective column 2 width
%S = @diff(@sendmsg(@winexists(~TABLE1),@sum($1000,29),1,0),10)
# Get mouse position relative to top left of Table
%X = @diff(@mousepos(X),@winpos(~TABLE1,L))
%Y = @diff(@mousepos(Y),@winpos(~TABLE1,T))
# If Mouse on Column 1 header ie. posn > left edge and < (left edge + column width) AND > top edge and < bottom edge
if @both(@both(@greater(%X,5),@greater(@sum(5,%C),%X)),@both(@greater(%Y,4),@greater(23,%Y)))
blah...blah...blah
# If mouse on Column 2 header
elsif @both(@both(@greater(%X,@sum(5,%C,15)),@greater(@sum(5,%C,10,%S),%X)),@both(@greater(%Y,4),@greater(23,%Y)))
blah...blah...blah
|
_________________ John Trappett |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sun Apr 01, 2007 1:12 am Post subject: |
|
|
I'm not sure if I'm using the right message number
Just for my education how would these *_FIRST values be translated. They aren't hex or decimal, what are they?
From CommCtrl.h
//====== WM_NOTIFY codes (NMHDR.code values) ==================================
#define LVN_FIRST (0U-100U) // listview
#define LVN_COLUMNCLICK (LVN_FIRST-8)
#define HDN_FIRST (0U-300U) // header
#define HDN_ITEMCLICKW (HDN_FIRST-22)
#define HDN_ITEMDBLCLICKA (HDN_FIRST-3)
#define HDN_ITEMDBLCLICKW (HDN_FIRST-23)
Anyone?? |
|
| Back to top |
|
 |
|