synchronized scrolling fileds

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

synchronized scrolling fileds

Post by quailcreek » Sat Apr 07, 2007 8:10 pm

Hi All,
Could someone point me to where I can find ifnormation on making synchronized scrolling fileds? ie two or more fileds that scroll using a single scroll bar.

Thanks
Tom

marielle
Livecode Opensource Backer
Livecode Opensource Backer

Re: synchronized scrolling fileds

Post by marielle » Sat Apr 07, 2007 9:30 pm

Hi Tom,

check out the List with numbers component in the open stacks gallery. The field with the row numbers scrolls at the same time as the one with the list content.

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Post by quailcreek » Mon Apr 09, 2007 5:52 pm

Thank you, Marielle. I'll take a look.

Tom

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am

Post by mluka » Sun Jul 08, 2007 2:33 pm

Hi, Marielle & Quailcreek.

The example seems to use a listfield (lines don't wrap to stay within the field confines).

I would like to synchronize the scrolling of several fields, but with one of the fields being able to display fairly long, wrapped, lines.

The application is this: an order entry screen where I would have 4 columns: lineNumber, itemQuantity, itemDescription and extendedPrice. "itemDescription" would need to be, occasionnally, fairly long; certainly longer than whatever width I can devote to that field on the screen (hence the need to have that field wrap).

If I limit myself to displaying only what fits within the width of that field, then I can use a listField and the solution is trivial.

But I really would like to display the entire contents of the item's description...

Any ideas? Thanks!

"... 9 days remaining in your trial."
Michel
Montréal, Canada

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Tue Jul 10, 2007 12:40 pm

As a small counter-balance to Marielles post, I'd make these observations.

Whilst in no-way wishing to deny that Marielle's experience is as she describes (I have no reason to doubt her), I have been using Revolution for 4 or 5 years, and have could hardly have had a more different experience. Yes, there are bugs, and sometimes they persist across many revisions of the product. This can be frustrating. I have also encountered bugs when using various forth, eiffel and ruby implementations.

Still, I find that I get more done, more quickly with Revolution than with anything else, though this also reflects the fact that I use it more, and know it better than the other languages, so it's kind of self-reinforcing.

I am one of those that has found 2.8.1 to be a good stable release, and has had almost no problems with it.

Even when I've had issues with the company, I have found them responsive and helpful.

So, my experience is mine, and Marielle's is hers. I hope she won't take this as a personal attack (it certainly isn't), and I'm sorry that she has found her experience so unpleasant, and I hope that she achieves everything she wants to using the tools she prefers.

Best wishes,

Mark

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am

Synchronized scrolling several fields

Post by mluka » Wed Jul 11, 2007 3:40 am

Hi, Marielle and Mark. Thanks for your comments.

But could we get back to my question on how to syncro-scroll fields with lines of different lengths (including "wrapped" lines)?

Thanks!

"... 6 days remaining in your trial."
Michel
Montréal, Canada

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Re: Synchronized scrolling several fields

Post by Mark Smith » Wed Jul 11, 2007 12:14 pm

Yes, back to the forum....

This is fairly basic, should work ok in the script of the 'master' field.

Code: Select all

on scrollBarDrag
  set the vScroll of fld "B" to the vScroll of me
end scrollBarDrag

on formatFields
  lock screen
  set the dontWrap of me to true
  filter fld "B" without empty
  repeat with n = the number of lines in me down to 1
    if the formattedWidth of line n of me > the width of me then
      put cr after line n of fld "B"
    end if
  end repeat
  set the dontWrap of me to false
  unlock screen
end formatFields
It assumes the presence of a field "B" which does not have wrapping lines. Also, you'd need to trigger the "formatFields" handler after filling the field initially.

It's a start, anyway.

Best,

Mark

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am

Post by mluka » Thu Jul 12, 2007 4:29 am

Hi, Mark
It's a start, anyway.
And a very good start!

All that remained to do was to add a bit of logic to take into account lines (in fld Master) that are several times longer than (the width of fld Master - the scrollBarWidth of fld Master) and to put the appropriate number of CR into fld B.

There is still a bit of a problem left to solve: if fld Master is not very wide, then when it is re-wrapped, at the end of handler "formatFields", some white space will be left at the end of each wrapped line. This may throw off the calculation that determines the number of CR to insert after each line of fld B.

I'll have to think of a way around this one...

Thank you very much for your response!
Michel
Montréal, Canada

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Thu Jul 12, 2007 5:20 pm

Michel, glad it was helpful!

Best,

Mark

Post Reply