how to change the properties of data grid scrollbar

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: FourthWorld, heatherlaine, Klaus, kevinmiller

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

how to change the properties of data grid scrollbar

Post by keram » Fri Apr 11, 2014 12:49 pm

Hi,

I'd like to change the width and color of the data grid scrollbar. There are no settings for this in the dg properties in the Inspector.
How to do it?

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

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

Re: how to change the properties of data grid scrollbar

Post by Klaus » Fri Apr 11, 2014 1:07 pm

Hi keram,

you can't, since the scrollbars are supplied by the underlying OS.


Best

Klaus

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Fri Apr 11, 2014 1:44 pm

Assuming you only have one data grid in your stack I find this works:

Code: Select all

set the width of scrollbar dgScrollbar to 32
"...this is not the code you are looking for..."

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: how to change the properties of data grid scrollbar

Post by keram » Fri Apr 11, 2014 5:27 pm

Thanks Dave and Klaus,

I tried with this - it increased the width, I saved the stack, closed it, opened it again, and the width is back to the standard.
So it seems that what Klaus is saying above is valid.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Fri Apr 11, 2014 6:27 pm

Hi Keram - well if it's not saving for you maybe you could include that line of code in your preOpenStack handler?

I respect Klaus tremendously but I don't see how a scrollbar in a datagrid can be a property of the OS and unchangeable - I've successfully increased its width for use on tablets without apparent problems
"...this is not the code you are looking for..."

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: how to change the properties of data grid scrollbar

Post by keram » Fri Apr 11, 2014 6:51 pm

Hi Dave,

Unfortunately it does not work with preOpenStack handler at all.
Are you working on a Mac? I'm on PC, maybe that's what is behind the difference?

Thanks anyway.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Fri Apr 11, 2014 8:56 pm

That's strange, maybe in a preOpenStack is too early then and it needs to be called later on in a preOpenCard or even openCard handler - or do you have more than one dg in your stack?

Today I'm developing on a mac but I've used this on Win2000 server (IDE and standalone) and Win8 tablet (standalone) ... apart from calling that line of script in the startUp process I have no idea why it isn't working for you :oops:
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Fri Apr 11, 2014 9:16 pm

Just realised I should make a stack that shows it (if I can) and post it here - which I will do in a bit - or if I can't get it working I'll post anyway and report that... :D
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Sat Apr 12, 2014 12:37 am

Hi Keram - just checked and it works on launch in an openCard handler but not the preOpenStack
"...this is not the code you are looking for..."

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: how to change the properties of data grid scrollbar

Post by keram » Sat Apr 12, 2014 2:18 am

Thanks Dave,

It works for me as well, on openCard handler. And the colours of the scrollbar can be changed in this way:
1. Select the DG
2. Click on Edit Group
3. Select the scrollbar
4. Select the Colors & Patterns in the Inspector
5. the rest you see in the images below; Border, Top and Bottom do not seem to be changeable - I tried and did not see any colour changes:
Change colours-LC-IDE.jpg
scrollbar custom colours1.png
In Windows the colours will remain the OS default but on Android they show up.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Sat Apr 12, 2014 11:31 am

Hi Keram

Your question has made me do some digging in these two excellent documents: data grid properties
http://lessons.runrev.com/s/lessons/m/d ... properties and data grid API (custom properties)
http://lessons.runrev.com/s/3527/m/data ... a-grid-api

From the former I found the more usual way to change scrollbar width, as opposed to the way I was doing it - and will be changing - is:

Code: Select all

set the dgProp["scrollbar width"] of grp "dgExample" to 35
You should also check out the “auto” setting on “scrollbar width” as well as the “effective scrollbar width”

The other thing I noticed about trying out datagrid scrollbar code on a mac and windows box is that Klaus is absolutely right! (no surprise there) for OSX - because on a mac while the width provided for the datagrid scrollbar may change, the actual scroller appears to stay constant - on Windows this is not the case and the scroller does change.

I’m afraid I don’t know how to change scrollbar colour the way you want and if I was in your position would be considering making a custom scrollbar, placing it above the standard one (or hide the standard one) and writing some code to get it to send appropriate scroll messages to the datagrid - but with any luck someone else will be able to chime in with better suggestions than this :)

Good luck!

Dave
"...this is not the code you are looking for..."

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: how to change the properties of data grid scrollbar

Post by keram » Sat Apr 12, 2014 1:49 pm

Hi Dave,

I'll look into the 2 pages you refer to again.
"auto" settings is the default and that is way to narrow to comfortably scroll the dg on my 8 inch tablet, probably even worse on smaller phones.

I'm quite happy with the options for changing colours that I found. Anything more complex and complicated to add to the already complex data grid may make it even more sluggish when scrolling.
Thanks for your suggestions.

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Sat Apr 12, 2014 3:38 pm

Curiouser and curiouser - just checked again on Windows (win7) and it's showing different widths fine there - hmm I wonder what is making the difference, something in how LC works with the underlying OS I guess :?:
"...this is not the code you are looking for..."

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

Re: how to change the properties of data grid scrollbar

Post by Klaus » Sun Apr 13, 2014 3:08 pm

Hi friends,

guilty of being a TAD Mac-centric! :D


Best

Klaus

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: how to change the properties of data grid scrollbar

Post by dave.kilroy » Sun Apr 13, 2014 5:54 pm

Hi Klaus - well when I was writing that changing scrollbar width works I was being Windows-centric!

...I like OS X much more than Windows and now do most of my development on it, but am still a relative noob compared to Windows (I still have Windows 'muscle-memory' i.e. I still regularly do ctrl+V instead of Cmd+V) :oops:
"...this is not the code you are looking for..."

Post Reply