Recent

Author Topic: How set SpeedButton.Font.Color := clgray; when flat=true, enabled = false  (Read 9836 times)

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
Hi.
I have speedbutton with flat = true, when i set enabled=false - nothing not happend and visibility of button is not change. That is why user can not detect - the button is enabled or not.

Q: how i may change / fix the source code of Lazarus(SpeedButton) to set:
Font.Color := clgray when enabled set to false (when flat=true)?

When flat = false it works correct for me.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
For which platform?  Also which Lazarus and FPC versions?  On MSWindows 7, setting Enabled:= False does what you are looking for with Lazarus 1.1 and FPC 2.7.1
Lazarus Trunk / fpc 2.6.2 / Win32

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
Ms Windows 7 32/64 bit.
1.0.4 fpc 2.6.0. Also 1.0.8 and fpc 2.6.2
« Last Edit: April 19, 2013, 01:09:15 pm by poiuyt555 »

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Hi.
I have speedbutton with flat = true, when i set enabled=false - nothing not happend and visibility of button is not change. That is why user can not detect - the button is enabled or not.

Q: how i may change / fix the source code of Lazarus(SpeedButton) to set:
Font.Color := clgray when enabled set to false (when flat=true)?

When flat = false it works correct for me.

TSpeedButton is drawn by widgetset specific theme engine, so you cannot change color or whatever (maybe you can but you'll probably get strange effect).
To fix your problem: create your own TMySpeedButton from TSpeedButton and override paint.


Avishai

  • Hero Member
  • *****
  • Posts: 1021
I have attached an image of TSpeedButton with Enabled:= True and Enabled:= False on MSWindows.  This should be the normal behavior.
Lazarus Trunk / fpc 2.6.2 / Win32

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
Thanks, zeljko.
Code: [Select]
To fix your problem: create your own TMySpeedButton from TSpeedButton and override paint.What exactly i must override OnPaint event, or what?

Thanks, Avishai, but you not set flat=true.
See my attachment
1) enabled=true, flat = false
2) enabled=false, flat = false
3) enabled=true, flat = true
4) enabled=false, flat = true 

See: 3 and 4 looks the same - this is not correct for me.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
It behaves exactly the same if Flat:= True with Lazarus-1.1-40830-fpc-2.7.1-win7-64
« Last Edit: April 19, 2013, 05:18:22 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
thanks!
Do you know, is it fixed in the latest official release?
 lazarus-1.0.8-fpc-2.6.2
or it is in snapshots?
Lazarus-1.1-40379-fpc-2.6.1-20130224-win32.exe
or only with Lazarus-1.1-40830-fpc-2.7.1
then where can i get  Lazarus-1.1-40830-fpc-2.7.1?
And it is with fpc 2.6.2?

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Hopefully this will get you what you want.

ftp://freepascal.dfmk.hu/pub/lazarus/snapshots/
Lazarus Trunk / fpc 2.6.2 / Win32

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
I check:
Lazarus-1.1-40852-fpc-2.6.2-20130420-win64.exe - not fixed
Lazarus-1.1-40852-fpc-2.7.1-20130420-win32.exe - NOT WORKING on my PC.
I can not run this lazarus. Click Start IDE and .... nothing.
In task manager lazarus.exe proces is, but nothing not works... Why - i dont know. (I ask this question (why not working) in general forum)

I think, that this speedbutton behavior depends of Lazarus version, not fpc version?
« Last Edit: April 20, 2013, 01:01:32 pm by poiuyt555 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
I think, that this speedbutton behavior depends of Lazarus version, not fpc version?

It depends on Windows themes and settings as zeljko mentioned. There have been no changes in speedbuttons recently in LCL.
Remember, LCL is not a custom drawn widgetset. It uses native widgets directly.

I don't know what must be done in your Windows to make it look right.
I remember similar issues with the color of labels, groupboxes and others. I wanted to implement the filter in Options dialog so that it puts a distinctive color on matched items, but it was shown correctly only in some Windows machines and I had to change the effect to Bold-Italic style.
It worked well with other widgetsets like GTK2 and QT.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
Ok, that is a system limitation, but in my app - there is a lot of such buttons ...
I have found in forum: Lazarus custom drawing controls - i try them,( if they have flat property)
Or i will try to
Quote
create your own TMySpeedButton from TSpeedButton and override paint.
But now i dont know how to do it.
Or var.3: do not do nothing and stay as is.  :)
« Last Edit: April 20, 2013, 04:35:27 pm by poiuyt555 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Or var.3: do not do nothing and stay as is.  :)

Or 4. figure out how to configure Windows. It may not be trivial. I don't remember any clear instructions from earlier discussions.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

poiuyt555

  • Jr. Member
  • **
  • Posts: 91
i think that v4 - it is not valid, because if i made my app not only for myself - i dont think that someone will begin to configure his windows.
i check on some new, not modified standart windows 7 - and it is equals (enabled or not).
i may check on windows 8.
That is why, in that case, i think, than the solution must be universal and not depend of my will: change or not some Windows settings.
« Last Edit: April 20, 2013, 08:08:28 pm by poiuyt555 »

 

TinyPortal © 2005-2018