Accessing or simulating MacOS scrollbar behavior preference

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

PlaidFlannel
Posts: 12
Joined: Fri Aug 21, 2020 7:06 pm
Location: Denver, CO

Accessing or simulating MacOS scrollbar behavior preference

Post by PlaidFlannel » Thu Oct 01, 2020 7:11 pm

I'm new to LiveCode, so before tackling this myself, I thought I'd ask if this has been discussed before.

Is there a way to have LiveCode on MacOS honor the scrollbar behavior preference in the General preferences? In particular, the preference choices are "Jump to the next page" and "Jump to the spot that's clicked".

If honoring that preference is not possible, has anyone simulated it using something like a button overlaying the scrollbar?

Thanks.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by dunbarx » Thu Oct 01, 2020 7:52 pm

Hi.

Not sure about doing this in LC Script. Possible, I think, in LC builder.

You can certainly roll your own, where a click in a locked transparent field overlying a scrollbar will set the scroll a full page higher or lower. To do this, you also need to know the thumbPosition and thumbSize. But this is all straightforward.

Craig

kdjanz
Posts: 232
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by kdjanz » Thu Oct 01, 2020 10:29 pm

You might try using the pageIncrement property

Code: Select all

set the [b]pageIncrement[/b] of scrollbar to pageAmount
Specifies how far a scrollbar moves when the user clicks somewhere in its gray region.

It also relates to the scrollbarPageDec scrollbarPageInc messages.

You should be able to control what you want to do with user clicks in the scrollbars.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by dunbarx » Fri Oct 02, 2020 1:30 am

@kdjanz
...the pageIncrement property...
Sure, but in order to be able to have the thumb settle at whatever part of the gray region the user clicks at requires more fiddling. This was one of the features the OP wanted.

Craig

kdjanz
Posts: 232
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by kdjanz » Fri Oct 02, 2020 1:49 am

Oh yes, you do have to ask the user what they want, then save it as a preference and then do the appropriate calcs when you get the messages from a click. If you are wanting to read the system wide preference, I don't know how to do that. (if there is a system wide one - Mac has one, but don't know about any other platform).

PlaidFlannel
Posts: 12
Joined: Fri Aug 21, 2020 7:06 pm
Location: Denver, CO

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by PlaidFlannel » Sat Oct 10, 2020 7:14 pm

Thanks to all responders. It seems that there may be LiveCode scrollbar properties and messages that would allow implementation of the scrollbar behavior I am seeking via LiveCode scripting. Again, the goal is for a scrolling field in one of my own LiveCode stacks to exhibit scrollbar behavior in which a click far below the thumb results in the thumb being moved to the point of the click (and, of course, the field contents scrolling the corresponding amount).

However...

I noticed that the "Dictionary" button on the LiveCode toolbar opens a window in which the scrolling fields ALREADY DO HONOR the MacOS scrollbar behavior preference. If that preference is changed while the Dictionary is open, the new preference is honored as well. I can imagine two possible reasons for this:

1. On MacOS machines, the Dictionary window IS NOT implemented in LiveCode, but in a language that uses native MacOS user interface components.

2. On MacOS machines, the Dictionary window IS implemented in LiveCode, but the scrollbar behavior code somehow accesses the MacOS preferences.

To complicate the problem a bit, I tried it on a Windows 10 machine with LiveCode 9. The Dictionary window's field scrollbars DO NOT exhibit the desired behavior. A click far below the thumb results in the thumb moving down approximately the height of the thumb, which corresponds to one "page" of text in the field.

I would appreciate further clarification.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by dunbarx » Sun Oct 11, 2020 1:40 am

Are you trying not to roll your own? That is a question, not a dig. Really.

Again, if you know the thumbSize and the thumbPosition, and also know the height of the scrollbar, you can make a click anywhere in that space do whatever you want to the thumb, and of course set the scroll appropriately. This is a kludge, of course.

Do you need advice on how to do that? Or am I missing it altogether?

Craig

SparkOut
Posts: 2324
Joined: Sun Sep 23, 2007 4:58 pm

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by SparkOut » Sun Oct 11, 2020 10:24 am

I had thought that the window components such as scrollbars were handled by the underlying operating system to be rendered (except on mobile, where a slight change of syntax and card construction is required to choose native components).
Windows doesn't have this behaviour anyway. I am surprised there is a difference in behaviour on Mac of the Dictionary window scrollbar to other scrollbars. I would definitely think it's worth checking what causes the difference.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8172
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by FourthWorld » Sun Oct 11, 2020 4:48 pm

The difference you see with the Dictionary is that it's made with a Browser widget.

The philosophy with LiveCode has been that it values the flexibility to tailor GUI behavior where it can, but makes it easy to create GUIs by providing OS-savvy behavior by default.

With that in mind, I would consider any difference in scrolling behavior been LC and other apps on a given platform to be a bug, and would submit a request that it be made conformant with current user expectations.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5680
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by jacque » Sun Oct 11, 2020 6:01 pm

Except historically a click below the thumb has always moved down one page height. I'm still on Mojave, has that changed?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by dunbarx » Sun Oct 11, 2020 9:49 pm

Except historically a click below the thumb has always moved down one page height. I'm still on Mojave, has that changed?
Jacque, I wouldn't think so. A scrolling field does not have a pageIncrement property (like a scrollbar) so it always seems to scroll one "page" determined by the number of visible lines. Thus my thought, that the OP would have to roll his own.

Craig

kdjanz
Posts: 232
Joined: Fri Dec 09, 2011 12:12 pm
Location: Fort Saskatchewan, AB Canada

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by kdjanz » Sun Oct 11, 2020 9:58 pm

ScrollOptions.png
Jacque - you have always had the option on the Mac about how you want the system to work. If any program uses the system scrollers, it will honour this setting. LiveCode should too I think.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7168
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by dunbarx » Sun Oct 11, 2020 11:07 pm

The system preferences selection you mention does not apply to a scrolling field in LC. It does seem to do so in other programs, like Safari and textEdit.

One has to roll one's own.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8172
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by FourthWorld » Mon Oct 12, 2020 5:08 am

If it's an option in the OS probably best to flag the report as a feature request rather than a bug.

Either way, LC should be expected to deliver normal behavior for normal controls.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

PlaidFlannel
Posts: 12
Joined: Fri Aug 21, 2020 7:06 pm
Location: Denver, CO

Re: Accessing or simulating MacOS scrollbar behavior preference

Post by PlaidFlannel » Mon Oct 12, 2020 4:56 pm

Here's an unusual behavior of this forum.

If I read this topic (on scrollbar behavior) without logging in, I can see the image posted by kdjanz on October 11.

If I log in before reading this topic, the image is blocked and I see the message: "You do not have the required permissions to view the files attached to this post."

It is not obvious what problem this forum behavior is intended to solve.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”