scrollbar reference of a scrolling field

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dougr
Posts: 14
Joined: Thu Oct 14, 2010 10:58 pm

scrollbar reference of a scrolling field

Post by dougr » Fri Nov 22, 2013 10:02 pm

How do you specify the "scrollbar" of a scrolling field? "thumbpos", "startvalue", "endvalue" and a myriad of other commands and property require a "scrollbar" reference/handle... but I cannot find such a reference at all. I get the vScroll property to work because it allows a reference to the field containing a scroll bar.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: scrollbar reference of a scrolling field

Post by dunbarx » Fri Nov 22, 2013 10:55 pm

Hi.

You are mixing apples and orange juice.

A "scrollbar" is a native object in LC. It is not a style of a field. It has those properties you mentioned, like "thumbPos", etc.

But the scrollbar of a field is a pseudo-object associated with a field, an adjunct. A FIELD has properties, and will have properties such as "scroll". Of the field.

So there is no reference to the scrollbar of a field as a separate object. This is probably a good thing.

Craig Newman

EDIT: To drive this home, you will get an error if you ask for, say, the "thumbPos" of a scrolling field, and also if you ask for the "scroll" of a scrollbar. These are properties that just do not belong to those objects. But you can set the "thumbPos" of a scrollbar, and you can set the "scroll" of a field (you will not get an error even if it has no scrollbar)

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: scrollbar reference of a scrolling field

Post by Klaus » Fri Nov 22, 2013 11:06 pm

Hi Doug,

1. welcome to the forum!
2. what Craig said!
Just check -> Scrollbar H or V for that field in the Property Inspector and that was it :D
The "Scrollbar" object is something different!


Best

Klaus

dougr
Posts: 14
Joined: Thu Oct 14, 2010 10:58 pm

Re: scrollbar reference of a scrolling field

Post by dougr » Sat Nov 23, 2013 4:50 pm

Thank you both and thanks for the fast response.

I understand the differentiation, I was hoping that I could have the "rich" set of properties and commands available to a "true" scrollbar object with the (what do you call it, if not a scrollbar) thingie of a field.

I must have set or unset some property to the scrolling list field I defined because it lost the "native" ability to react to the mouse scrolling wheel. The scolling bar is there, it reacts to the up and down arrows, page up and down, Ctrl-Home and End and dragging the thumb... but no response to the mouse scrolling wheel. I was able to cobble together a workaround using Vscroll, rawKeyDown and scrollbarDrag but finding things like the "end-of-scroll" pixel value to I could get the rawKeyDown to stop properly was a bit of a stretch.... rather than just being able to use endValue or its like.

I see, if I a create a very simple stack with a simple scrolling List Field, the scrolling wheel works fine ... any idea what *I* did to lose that characteristic?

I'm a bit surprised at Craig's comment: "... So there is no reference to the scrollbar of a field as a separate object. This is probably a good thing...." ??? A combo field, having both button and field-like characteristics, has access to many (not all, granted) of the aspects of BOTH components. I'm actually surprised that the thingie scrollbar of a field is so limited. ... but I can live with it... I guess.

Doug

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: scrollbar reference of a scrolling field

Post by Klaus » Sat Nov 23, 2013 4:52 pm

Hi Doug,
dougr wrote:I see, if I a create a very simple stack with a simple scrolling List Field, the scrolling wheel works fine ... any idea what *I* did to lose that characteristic?
not without looking at your script(s), if any.


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: scrollbar reference of a scrolling field

Post by dunbarx » Sat Nov 23, 2013 5:58 pm

Typical user expectations in a scrolling field are focussed on the field, not the scrollbar, which is used only to navigate the contents of that field. In that sense, the only property of interest is the "scroll" value, and that can be ascribed entirely to the field, the scrollbar being merely a handle to adjust that property, and a rough indicator of the value of that property.

A scrollbar object is just built differently, in that it sort of "is" its scrollbar, though with other functionality as well, for example displaying a scaled value of the thumbPosition. Could those objects share more of their properties? Maybe.

What did you really mean when you asked to "specify" the scrollbar of a field? In other words, what property, really, were you seeking? Whatever it was, I bet there was indeed a property that would have fit the bill.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: scrollbar reference of a scrolling field

Post by jacque » Sat Nov 23, 2013 8:42 pm

dougr wrote:I see, if I a create a very simple stack with a simple scrolling List Field, the scrolling wheel works fine ... any idea what *I* did to lose that characteristic?
A keyDown or keyUp handler could block it if it doesn't pass the message. The scrollwheel is treated internally like a keypress.

I've never needed to address the scrollbar of a field directly. As Craig said, it just reflects the current scroll of the field itself. The thumbposition is a mirror of the field's current scroll and anything you could get from the thumbposition can be retrieved using the field scroll. You do get all messages related to user interaction with the scroller, such as scrollbarLineInc, scrollbarDrag, etc. The startvalue is always zero so you don't need a property for that. The end value is irrelevant because you can't set that on a field; the end value is always the distance of a fully scrolled field.

So like Craig, I'm wondering what property you want to retrieve.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dougr
Posts: 14
Joined: Thu Oct 14, 2010 10:58 pm

Re: scrollbar reference of a scrolling field

Post by dougr » Tue Nov 26, 2013 6:57 am

Thanks again for the responses and information.

Klaus
There is too much code to provide... that's why I tried a very simply test only to find that the scroll wheel works perfectly on a pristine stack, card and scrolling field. So I figured it must be something I'm doing (or not doing), so I was looking for a very generic idea, like Jacque's.

Craig and Jacque...
Due to the lack of the scroll wheel working (which is undoubtedly due to somthing *I* did), I thought if I could acquire the properties (like endValue) of the field's scrollbar, I could emulate the wheel using the rawKey message. In fact, that's exactly what I found a way of doing, using some other forum tricks like setting the vScoll to 100000 and reading in the actual Vscoll value. That gives you the "endValue". Linked to the reSize Message, it can be manipulated quite easily and provide the scroll wheel functionality.. even though I had broken it elsewhere in my code.

I'll use Jacque's suggestion and look for un-passed messages. Thanks for all the help and I am duly impressed with how effective this forum is! ... Keep up the good work!

Doug

Post Reply