table format in Rev 2

Jan Schenkel janschenkel at yahoo.com
Sun Apr 6 10:04:01 EDT 2003


--- yves COPPE <yvescoppe at skynet.be> wrote:
> >
> >If you need a hand with that, I'm sure we can help.
> >
> >Jan Schenkel.
> >
> 
> 
> I'm waiting...!!!
> You always write such nice solutions (as the drag 'n
> drop f. ex.)
> 
> Could you once again make a wonderful surprise for
> us ???? and write 
> a table with formatted columns ???
> 
> Thank you.
> -- 
> Greetings.
> 
> Yves COPPE

Hi Yves,

And there I thought the biggest fun in programming was
finding the solution yourself ?  *grin*
In that spirit of entrepreneurschip, I'll just give
you a general explanation, a few partial scripts and
some more hints. :)

So open RunRev and try the following :
- create 3 fields of the same height next to one
another
- give the rightmost one a vertical scrollbar
- group the three fields and set the group script to :
  # synchronise vertical scrolling
  on scrollBarDrag
    get the vScroll of fld 3 of me
    set the vScroll of fld 1 of me to it
    set the vScroll of fld 2 of me to it
  end scrollBarDrag
  # synchronise selection
  on selectionChanged
    get the hilitedLines of the target
    set the hilitedLines of fld 1 to it
    set the hilitedLines of fld 2 to it
    set the hilitedLines of fld 3 to it
  end selectionChanged

This leaves a few more visual glitches to fix :
  + the selection isn't updated accross the lines
while the mouse is being held down
  + the arrowKeys can cause disruption as well as no
selectionChanged message is sent

- to fix the first glitch, add the following to the
group script
  # synchronise selection changes [live]
  local sTrackingSelectionChanges
  on mouseDown
    put true into sTrackingSelectionChanges
  end mouseDown
  on mouseRelease
    put false into sTrackingSelectionChanges
  end mouseRelease
  on mouseUp
    put false into sTrackingSelectionChanges
  end mouseUp
  on mouseMove x,y
    -- crude, but it works
    lock screen
    send "selectionChanged" to me
    unlock screen
    pass mouseMove
  end mouseMove
- to fix the arrowKey problem, have a look at the
script I posted over on the RunRev documentation WIKI:
http://wiki.macitworks.com/revdocs/2674

A few more advanced things you could add to the group
script :
  + setProp handlers to set the data of the entire
table or of a single cell
  + getProp handlers for the reverse

But I'll leave those up to your imagination (or you
could have a look at the table object on the RunRev
contributions webpage) and wish you happy scripting.
*cheers*

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com



More information about the use-livecode mailing list