Combo-box/popup menu in a list field?

Ben Rubinstein benr_mc at cogapp.com
Tue Feb 25 13:47:00 EST 2003


on 21/2/03 12:32 pm, valetia at mac.com wrote

> Your method sounds exactly like what I had actually tried to accomplish
> (display a popup at a specific location per line).
> 
> However, I did run into a problem (still unsolved) that perhaps you know the
> answer to.
> 
> It's also why I had posted an earlier message (to which there have not been
> any replies) regarding the strange behavior of clickChunk with list fields.
> 
> Here's what I had posted in that earlier message:
> 
> "When the listBehavior of a field is set to true, it seems the clickChunk
> returns the hilitedLine instead...(could this be a bug?)
> 
> "How do you get the "actual" clickChunk then?"
> 
> So a related question would be, with the method you just described, do you
> use the clickChunk to determine the location of the click, or something
> else?

HI Valetia

Sorry I've only just read your reply.  This list is very active and I often
skip chunks altogether....

When I've done this, I've not made use of the clickChunk.  I can't swear
that I've done it with a field who's listBehaviour is set to true. But to
give you an idea, here's a handler from a field where I'm currently doing
something like this.

It just so happens that in this case my list has three sections to each row,
and I'm using tabs to format it; and I only want the menu to appear when the
user clicks in the third column.  The actual code in this case is:

    on mouseDown
      put word 2 of the clickLine into n
      put the clickH - the left of me into xPix
      put the tabStops of me into tStops
      if xPix > item 2 of tStops then
        setFieldNewNameD n
      end if
    end mouseDown

...where 'setFieldNewNameD' happens to be handler in the card script when
ends up by using the popup command to popup a menu button.  So in this case
I am actually using 'click-family functions', which might or might not give
the right results if the field listBehaviour was set to true; but I think
the real point is that this is doing some pixel level calculations, to work
out what bit of data the user is operating on.

In another project, I'm pretty certain that I actually created an array (or
was it a custom property of the field?) at the time that I format the text
to put into the field, precisely so that when the user clicks somewhere on
it I'd be able to do a quick calculation to work out what chunks _in my
terms_ the user had clicked on.

Does that help?  I'm not really sure if it's clear - if you're still having
trouble (and you may in any case have solved your problem by now) come back
to me if you want more explanation.
 
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866





More information about the use-livecode mailing list