Re: Win32Lib: listbox: select item with RIGHT mouse click?
Matt,
<grin!> That's what I was afraid you were talking about! I think I'll give
Al's solution a try first, looks easier! :) Thanks.
Dan
----- Original Message -----
From: "Matt Lewis" <matthewwalkerlewis at YAHOO.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, September 02, 2000 10:26 AM
Subject: Re: Win32Lib: listbox: select item with RIGHT mouse click?
> That's exactly what I'm talking about. :) A hittest is basically figuring
out
> which, if any, item is 'hit' by a given point. In this case, we're
interested
> in finding out which item might be under the mouse pointer. Take a look
at
> hitTestTV (in Win32Lib) to get an idea (although windows does most of the
hard
> stuff for that).
>
> I don't have the details of LB_GETITEMRECT and LB_GETTOPINDEX in front of
me,
> but you can find them in either the Win32 help file (which everyone who
codes
> in windows should have handy) or online at Microsoft's MSDN library (just
do a
> search at msdn.microsoft.com).
>
> I think the hit test pseudo code should go something like this:
>
> - get the position of the mouse cursor
> - figure out how big each item in the list box is (you could do this ahead
of
> time)
> - get the first item listed
> - compute how far down on the list the mouse is, based on the item size
> - if there is an item there (ie, if the list is long enough), return the
index
>
> Then, in an onMouse routine for your listbox, I'd trap the right click,
and do
> a hittest. If a positive index is returned, set that as the selection,
and
> then do whatever else you wanted (like opening a popup menu).
>
> Matt
>
> --- Dan B Moyer <DANMOYER at PRODIGY.NET> wrote:
> > Matthew,
> >
> > Could you explain what you mean by a "hit test"(ie, hits what, since no
> > index is returned), & how to use LB_GETITEMRECT and LB_GETTOPINDEX for
the
> > hit testing? (Are you talking about getting the size( y extent) of the
> > listbox, the y position of the right-mouse click in the listbox, the
number
> > of items in the listbox, the y size of each item, & then compute which
item
> > was clicked on from all that??)
> >
> > Dan
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
|
Not Categorized, Please Help
|
|