how to change the properties of data grid scrollbar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
how to change the properties of data grid scrollbar
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
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
Re: how to change the properties of data grid scrollbar
Hi keram,
you can't, since the scrollbars are supplied by the underlying OS.
Best
Klaus
you can't, since the scrollbars are supplied by the underlying OS.
Best
Klaus
-
- 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
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..."
Re: how to change the properties of data grid scrollbar
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
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
-
- 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
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
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..."
Re: how to change the properties of data grid scrollbar
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
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
-
- 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
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
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

"...this is not the code you are looking for..."
-
- 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
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... 

"...this is not the code you are looking for..."
-
- 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
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..."
Re: how to change the properties of data grid scrollbar
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: In Windows the colours will remain the OS default but on Android they show up.
keram
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: 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
-
- 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
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:
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
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
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..."
Re: how to change the properties of data grid scrollbar
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
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
-
- 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
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..."
Re: how to change the properties of data grid scrollbar
Hi friends,
guilty of being a TAD Mac-centric!
Best
Klaus
guilty of being a TAD Mac-centric!

Best
Klaus
-
- 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
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)
...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)

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