Divider line in list fields

Jan Schenkel janschenkel at yahoo.com
Fri Sep 13 05:20:01 EDT 2002


--- Alan Gayne <alanIra9 at mac.com> wrote:
> I may have missed it in the documentation, but is
> there any way to put a 
> true non
> selectable divider line (similar to those in a pull
> down menu) in a list
> field?
> 
> I've tried using the " - " character that works in
> the menu - but all I 
> get
> is a " - "  -  duh!
> 

Hi Alan,

There's no built-in option for divider lines in a list
field, but you can sort of emulate one with the
following trick:

Where you want the divider line, insert a line with a
few spaces. Then set the text style of that line to
"Strikeout".
See how a horizontal line is forming? Fill up the rest
of that line.

Now add a custom property to the field:
  uDividerLines
and put the line numbers of the divider lines in that
property, separated by commas.

Finally, set the script of the field to:

local sOldHilitedLines
on mouseUp
  put the uDividerLines of me into tDividers
  if word 2 of the clickLine is among the items \
  of tDividers then
    set the hilitedLines of me to sOldHilitedLines
  else
    put the hilitedLines of me into sOldHilitedLines
  end if
end mouseUp

How's about that for a quick hack? *grin*

Mind you, the above script doesn't work if you allow
multipleHilites and some smart-ass user makes a
shift-click selection that spans the divider line.

If that's your type of list field, use the following
script:

on mouseUp
  put the uDividerLines of me into tDividers
  repeat for each item tLineNum in the \
  hilitedLines of me
    if tLineNum is not among the items of tDividers
    then put tLineNum & "," after tHilitedLines
  end repeat
  set the hilitedLines of me to \
  (char 1 to -2 of tHilitedLines)
end mouseUp


> ALSO, what is the correct command to de-select all
> of the selected lines 
> in a list field?
> 

The easiest is:
  set the hilitedLines of field "x" to empty

> Thanks in advance
> 
> Alan
> 

Hope this helped,

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish
at the same time."  (De Rochefoucald)

__________________________________________________
Do you Yahoo!?
Yahoo! News - Today's headlines
http://news.yahoo.com



More information about the Use-livecode mailing list