On Feb 27, 2009, at 4:05 am, Christian Dorn wrote:
I want users to be able to contextual-click (right-click, control-
click) on the header of a listbox, so I can display a menu where
the user can choose which column to show/hide. Just like many Apple
apps do (iTunes, Mail, etc).
But I can't get this to work. A right-click on a listbox header
acts just like a left-click; even calling IsContextualClick() in
the HeaderPressed event returns "false".
You have to catch the right-click in the ListBox's MouseDown event!
To find out, if the user clicked on the header, check the event's
'y' parameter.
if y < 20 and IsContextualClick() then
...
// return 'true' to prevent the HeaderPressed event form firing
return true
end if
I don't know, if there is a way to get the correct height of the
header, but 20 seems a good value to me. At least on Mac OS X.
Interestingly, if you try to do this:
dim col as integer
col = me.ColumnFromXY(x,y)
in the MouseDown event, you get -1 I'd expect it to be able to figure
out which column you clicked....
Greg
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|