Jump to content


Photo

NxButton6 disabled look


  • Please log in to reply
9 replies to this topic

#1 bertrod

bertrod
  • Members
  • 98 posts
  • Gender:Male
  • Location:Switzerland

Posted 13 September 2019 - 11:51 AM

Hi,

 

In version 6.3.2 I noticed that when using a TNxButton6 with Style=stNative, when the button is Enabled=false it is not grayed.

For instance I'm using TNxButton6 with only an image (without text), and it is not possible to see visually when the button is enabled or disabled.

 

On my side, I could solve the problem this way:

 

- In NxCollection.pas : TNxButton6.Paint, under the line "if Focused...", I added the following line :

if not Enabled then Include(FState, bsDisabled) else Exclude(FState, bsDisabled);

- In NxStyles6.pas: TNxButtonStyle6.Paint, I changed the following line:

 

Previous version:

if bsDisabled in State then Index := tcToolbarButtonDown;

Corrected version:

if bsDisabled in State then Index := tcToolbarButtonDisabled;

(Note that this line appears 2 times in the function, but only the 2nd one is wrong).

 

I don't know if it was a bug, but the TNxButton6 now looks like the other buttons when disabled.

 

Hope it helps.



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,926 posts
  • Gender:Male

Posted 16 September 2019 - 09:09 PM

Thanks,

 

I will apply your fix into the code.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 PhilW2

PhilW2
  • Members
  • 4 posts

Posted 16 November 2020 - 03:59 PM

Hello Boki,

 

I am having exactly this problem with NxButton6, although I have the latest release installed, v6.6.0.  I have tried both bmp and png images, stNative and stVCLStyle individually and together, but the button glyph remains stubbornly drawn as if enabled.   Text is drawn correctly in a dark grey pen. 

 

I have debugged the code from TNxButton6.Paint, though .PaintContent and PaintIcon, with the internal field FState still holding [bsDisabled] and then it disappears into the rabbit hole that is Vcl.Graphics.Canvas.Draw.

 

I am using Delphi 10.4.1 (Sydney).

 

Any chance you could look at this again, please?

Kind regards

PhilW.



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,926 posts
  • Gender:Male

Posted 16 November 2020 - 04:30 PM

Hello Phil,

 

Is it possible to send me a screenshot of how the buttons looks for you?

 

As far I can see all work fine, but not sure.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 bertrod

bertrod
  • Members
  • 98 posts
  • Gender:Male
  • Location:Switzerland

Posted 17 November 2020 - 03:12 PM

Hi PhilW2,

 

For your info I'm now also using v6.6.0 with Delphi 10.4.1 and I had to add a line in TNxButton6.Paint :

    if Focused then Include(FState, bsSelected);
    if not Enabled then Include(FState, bsDisabled) else Exclude(FState, bsDisabled); //<-- This is the new line which I added

Hope it helps



#6 PhilW2

PhilW2
  • Members
  • 4 posts

Posted 17 November 2020 - 03:16 PM

Hello Boki,

 

Thank you for your quick response.  Here is a screenshot. 

 

(Sorry; You are not allowed to use that image extension on this community)

 

I have taken the snapshot in the middle of an insert transaction - so the 'Add' and 'Delete' control buttons are disabled; the 'Save' and 'Cancel' buttons are enabled - as you can see they all look enabled.   Also Note the 'Close' button - that is disabled, as you can from the text, so it is the image that is not being drawn correctly.

 

Hope this helps,

Phil.

 

Attached File  Screenshot showing NxButton6 disabled draw bug.png   31.69KB   2 downloads



#7 PhilW2

PhilW2
  • Members
  • 4 posts

Posted 17 November 2020 - 03:33 PM

Hello Bert,

 

Thanks for the suggestion;  but I'm a little confused.  v6.6.0 of NxCollections.pas TNxButton6.Paint already has a line that adds the bsDisabled state:

if not Enabled then Include(FState, bsDisabled);

Indeed, it doesn't have the 'else' part of the statement but is not relevant to the issue. Although I did try the complete line, just in case, but unsurprisingly it had no effect.

 

It's a bit of a mystery at the moment.

 

Kind regards

PhilW.



#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,926 posts
  • Gender:Male

Posted 17 November 2020 - 03:50 PM

Hi, 

 

I understand now, you also need images to be gray too?


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 PhilW2

PhilW2
  • Members
  • 4 posts

Posted 17 November 2020 - 09:47 PM

Hello Boki,

 

Yes please. It is a standard way to show that the button is disabled.  Next Suite 5's TNxButton worked correctly.

 

Thanks in anticipation,

PhilW.



#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,926 posts
  • Gender:Male

Posted 17 November 2020 - 10:39 PM

Hi,

 

I will fix it soon.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users