List field multipleHilites property

Ken Ray kray at sonsothunder.com
Wed Jun 20 21:24:11 EDT 2007


On Wed, 20 Jun 2007 20:57:29 -0400, Michael Binder wrote:

> Hi everyone,
> 
> I am trying to make a list field in which multiple lines can be 
> hilited, but they must be contiguous.  I can't seem to do it.  Am I 
> up against a bug?  Rev 2.8.1, ibook G4, OS 10.3.9
> 
> To demonstrate:
> 1) Create a new main stack.
> 2) Drag onto it a default scrolling list field from the tool pallete.
> 3) Add 5 more lines of text (choices 4-8).
> 4) Make the field tall enough so that you can see all 8 lines.
> 5) Set the multipleHilites of the field to true.
> 6) choose browse tool
> 7) select the first 3 lines of the list field
> 8) Click somewhere on the card so the field loses focus
> 9) Hold the shift key down and click on line 6
> 
> The weirdness is apparent:  Lines 1,2, and 6 are hilited.
> The selectedlines returns 'line 1 to 2 of field 1'
> The hilitedlines returns '1,2,6'
> 
> Is this a bug? How can I make the list show only contiguous selections?

It is a bug, but it is specifically one related to "clicking on the 
card so the field loses focus". If you don't do that, the field will 
show only contiguous selections. Here's a workaround in the meantime 
(put this in the list field):

on focusOut
  set the uHilited of me to (the hilitedLines of me)
end focusOut

on focusIn
  if the shiftKey is down then
    put item 1 of (the uHilited of me) into tStart
    put word 2 of the clickLine into tEnd
    put "" into tHilites
    repeat with x = tStart to tEnd
      put x & "," after tHilites
    end repeat
    delete char -1 of tHilites
    send "hiliteMe" && quote & tHilites & quote to me in 10 milliseconds
  else
    put the uHilited of me
  end if
end focusIn

on hiliteMe pLines
  set the hilitedLines of me to pLines
end hiliteMe

HTH,

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



More information about the use-livecode mailing list