clickText in a List Field

Ken Ray kray at sonsothunder.com
Tue Sep 10 14:07:01 EDT 2002


Even easier is to check the clickText, which will return empty if you don't
click on a line of text, and will return the text of the line you clicked
(even if you click on spaces between words in a line). I traditionally trap
this to deselect any selections in the field. Note you have trap this in a
*mouseDown* and not a *mouseUp*, otherwise it won't work:

on mouseDown
  if the clickText is empty then
    set the hilitedLines of me to ""
  else
    -- do something related to clicking on an actual list line, or ignore
  end if
end mouseDown

Enjoy!

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



----- Original Message -----
From: <TBleiler at aol.com>
To: <metacard at lists.runrev.com>
Sent: Tuesday, September 10, 2002 12:22 PM
Subject: re: clickText in a List Field


>
> >>This is something I've wanted for a while, but unfortunately I >wouldn't
> have
> >any use for it if clicking spaces between words is going to >falsely
report
> >that the user clicked below the last line.  Let's hope there's >another
way.
>
> Actually my problem was with the space at the end of the line rather than
> between the lines, which is what I think you're describing. I've dealt
with
> the between line problem with this function. It may not work as is for all
> possible field properties but I'm sure the equations could be adjusted for
> specific conditions or made more general.
>
>  Function MyClickLine CloseLine, ActiveField
>
>   # CloseLine is the line number returned as word two of ClickLine ()
>   # Allows for more precise selection of lines from formatted text flds.
>   # When line heights are greater than a single line the standard
clickline
> functions
>   # are not accurate. This function corrects that problem so that the user
> really has
>   # to hit the visible lines not the spaces between them.
>   # 9 pixels are added to the equation if widemargins is true
>   # The target is assumed to be a field.
>   # ActiveField is the short Name of the field we are using. It is assumed
to
> be in
>   # the defaultStack
>
>  if the WideMargins of fld ActiveField = true then put 9 into WM
>   Else put 0 into WM
>
>   -- 4 pixel buffer above/below text.
>   --  Increase # to make wider area around text a valid line hit.
>   Put 8 into Buff
>
>   put item 2 of the rect of fld ActiveField into r
>   put the ClickV into CV
>   put the textHeight of fld ActiveField into TH
>   Put the textsize of fld ActiveField into TS
>   put CV-r into RelativeToFld
>
>   Put TH*(CloseLine) - TS into TopBorder
>   Put TH*(CloseLine) + WM + Buff into BottomBorder
>
>
>  if RelativeToFld>=TopBorder and RelativeToFld<=BottomBorder then
>     RETURN CloseLine
>   else
>     RETURN ""
>   end if
>
> end MyClickLine
>
>
> -- Tim Bleiler
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>




More information about the metacard mailing list