Recent

Author Topic: ThemeManager usage  (Read 3692 times)

mtournay

  • Jr. Member
  • **
  • Posts: 63
ThemeManager usage
« on: August 17, 2017, 11:24:13 pm »
Hi everybody

First, thank you Circular and all other people working on those amazing component !

I would like to ask you a modification to the way themeManager works. It's very simple, here is my problem :

I have an app with BCbuttons. All BCbuttons are in panels, some have glyph and when i started to work with theme manager two problems appears :
1. the apply() func is not recursive in panel, that's why none of my BCbuttons where modified....
2. when applying a style, the assign() func remove glyphs....

the first point... OK I call apply(aPanel) for each panel in my form, that's not a big deal. (but, for experience I made apply() recursive with Tpanel easily)
the second point is critical. So here is the modification I propose :

1. add a 'preserve' boolean property to defaultThemeManager
2. in assign() func, I add the following modifications :

   
Code: Pascal  [Select][+][-]
  1. preserve := false;
  2.     if assigned(TBCButton(self).FBCThemeManager) then
  3.       preserve := TBCDefaultThemeManager(TBCButton(self).FBCThemeManager).Preserve;
  4.  
  5.     if not preserve then begin
  6.       Glyph := TCustomBCButton(Source).Glyph;
  7.       FStaticButton := TCustomBCButton(Source).FStaticButton;
  8.       FDown := TCustomBCButton(Source).FDown;
  9.     end;

I had to add BCDefaultThemeManager to uses in implementation section

Do you think it's something good to add to your package ?

best regards
laz 2.06 32b - fpc 3.04 32b - win10 64b

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: ThemeManager usage
« Reply #1 on: August 18, 2017, 01:45:20 am »
Thanks. I'm adding it to the master in github.

BTW I added it in a different way, that is now a property of TBCButton and TBCButtonFocus, the property is 'property PreserveGlyphOnAssign;' and by default is on, and also can be changed in the object inspector.

Quote
1. the apply() func is not recursive in panel, that's why none of my BCbuttons where modified....

That's on purpouse. Because you can have 2 theme managers and apply one to a panel, and other to the other panel.
« Last Edit: August 18, 2017, 02:11:26 am by lainz »

mtournay

  • Jr. Member
  • **
  • Posts: 63
Re: ThemeManager usage
« Reply #2 on: August 18, 2017, 08:37:35 am »
Hi all

Thanks. I'm adding it to the master in github.
BTW I added it in a different way, that is now a property of TBCButton and TBCButtonFocus, the property is 'property PreserveGlyphOnAssign;' and by default is on, and also can be changed in the object inspector.

Thank you !


Quote
1. the apply() func is not recursive in panel, that's why none of my BCbuttons where modified....
That's on purpouse. Because you can have 2 theme managers and apply one to a panel, and other to the other panel.

I understand that. And it's a good way to deal with multiple theme in a project. But without documentation about that, I was lost. And, in code, there's a verification of the themeManagerName before applying style   ;)

Do you have an idea about next release date ?

Regards.
laz 2.06 32b - fpc 3.04 32b - win10 64b

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: ThemeManager usage
« Reply #3 on: August 18, 2017, 04:25:51 pm »
I released it now: BGRAControls v4.3.2.0.

mtournay

  • Jr. Member
  • **
  • Posts: 63
Re: ThemeManager usage
« Reply #4 on: August 18, 2017, 09:27:15 pm »
Ho that's fast !

but

I have a little problem. I now use OPM : bgracontrols is flagged new, i check the checkbox, click update -> download then install then rebuild and the package is not up to date... :(

Does this happens because I made modification in the package by myself ?
I should probably ask in the right section...

regards
laz 2.06 32b - fpc 3.04 32b - win10 64b

 

TinyPortal © 2005-2018