forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to generate a Click Event on a Table Column header?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
trapper
Contributor
Contributor


Joined: 28 Jan 2005
Posts: 112
Location: Brisbane, Australia

PostPosted: Tue Feb 01, 2005 11:24 pm    Post subject: How to generate a Click Event on a Table Column header? Reply with quote

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
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Fri Mar 30, 2007 6:45 pm    Post subject: Reply with quote

Did anyone ever find a way to detect a Column Header Click?
Back to top
View user's profile Send private message Send e-mail
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Sat Mar 31, 2007 8:24 am    Post subject: Reply with quote

Hi traper:

To detect the state of the mouse buttons looks this post:

http://www.vdsworld.com/forum/viewtopic.php?p=31837

Good Luck

_______________

uVeDeSe
_______________
Back to top
View user's profile Send private message Visit poster's website
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Mar 31, 2007 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sat Mar 31, 2007 4:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sat Mar 31, 2007 6:54 pm    Post subject: Reply with quote

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 Sad

I guess I'll have to put this one on my GadgetX list Smile

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
View user's profile Send private message Send e-mail
trapper
Contributor
Contributor


Joined: 28 Jan 2005
Posts: 112
Location: Brisbane, Australia

PostPosted: Sat Mar 31, 2007 9:55 pm    Post subject: Reply with quote

uvedese wrote:
Hi traper:

To detect the state of the mouse buttons looks this post:

http://www.vdsworld.com/forum/viewtopic.php?p=31837

Good Luck

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
View user's profile Send private message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Apr 01, 2007 1:12 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group