Page 1 of 1

Scrollbars - changing style when added later

Posted: Thu May 05, 2016 5:18 pm
by greggorob64
Hello. I originally added my scrollbars to my chart during the initialization of my chart. I'm doing all I can to improve startup time, so I modified my project to only create and add my scrollbar until the user needs them (they zoom in).

They changed appearance from this

Image

to this:

Image

How do I get them back to their original style? I'm not sure why the style changed?

Re: Scrollbars - changing style when added later

Posted: Thu May 05, 2016 7:10 pm
by ArctionPasi
Maybe ColorTheme property setting overrides the color settings?

Re: Scrollbars - changing style when added later

Posted: Thu May 05, 2016 8:04 pm
by greggorob64
That's definately the cause.

The old way (with loading scrollbars immediately)

1) program starts
2) add scrollbars
3) apply theme


the new way (lazy loading the scrollbars)
1) program starts
2) apply theme
(some time passes)
3) add scrollbars

I don't want to have to re-apply the theme to the entire chart, but is that my only option? I don't know how to apply theme to just the scrollbars.

Re: Scrollbars - changing style when added later

Posted: Mon May 09, 2016 5:39 pm
by ArctionPasi
Applying ColorTheme sets the colors of objects that currently exist in the chart. For objects to be created in the future, it has no effect.

Re: Scrollbars - changing style when added later

Posted: Tue May 10, 2016 12:40 pm
by greggorob64
I dug into the source code, and I pulled the 'set scrollbar colors' part of 'set theme' to its own public method (which set theme now calls), and was able to get it working. Was hoping I wouldn't have to change the code, but it seems the only way to get screen items to be the correct color when added at runtime.

Easy fix though :)


Also, if source code stuff is something I shouldn't be discussing on the forum, let me know and I'll take it down.

Re: Scrollbars - changing style when added later

Posted: Tue May 10, 2016 12:49 pm
by ArctionPasi
Great you got it solved :shock: Excellent work.

Discussing source code is perfectly OK in this level. Showing actual LC source code here would be too revealing though.