Page 1 of 2
how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 12:49 pm
by keram
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
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 1:07 pm
by Klaus
Hi keram,
you can't, since the scrollbars are supplied by the underlying OS.
Best
Klaus
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 1:44 pm
by dave.kilroy
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
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 5:27 pm
by keram
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
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 6:27 pm
by dave.kilroy
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
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 6:51 pm
by keram
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
Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 8:56 pm
by dave.kilroy
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

Re: how to change the properties of data grid scrollbar
Posted: Fri Apr 11, 2014 9:16 pm
by dave.kilroy
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...

Re: how to change the properties of data grid scrollbar
Posted: Sat Apr 12, 2014 12:37 am
by dave.kilroy
Hi Keram - just checked and it works on launch in an openCard handler but not the preOpenStack
Re: how to change the properties of data grid scrollbar
Posted: Sat Apr 12, 2014 2:18 am
by keram
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
Re: how to change the properties of data grid scrollbar
Posted: Sat Apr 12, 2014 11:31 am
by dave.kilroy
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
Re: how to change the properties of data grid scrollbar
Posted: Sat Apr 12, 2014 1:49 pm
by keram
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
Re: how to change the properties of data grid scrollbar
Posted: Sat Apr 12, 2014 3:38 pm
by dave.kilroy
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

Re: how to change the properties of data grid scrollbar
Posted: Sun Apr 13, 2014 3:08 pm
by Klaus
Hi friends,
guilty of being a TAD Mac-centric!
Best
Klaus
Re: how to change the properties of data grid scrollbar
Posted: Sun Apr 13, 2014 5:54 pm
by dave.kilroy
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)
