clickText in a List Field

TBleiler at aol.com TBleiler at aol.com
Tue Sep 10 13:23:01 EDT 2002


>>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



More information about the metacard mailing list