Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-07

Close button bkClose as "X"

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

José Mejuto

Hello Lazarus-List,

In a recent change (#26529) Dmitry changes the code in themes.pas to get a "stock icon" for close kind (a "X") which affects to TBitButton. Is this change intented ? If the answer is yes buttons in TBitButton are no more configurable via resources and btn_close.png is not needed anymore. Why only btn_close and no btn_ok and others ?

Best regards, Jos?

Reply by email

Jesus Reyes
to José Mejuto

--- El dom 25-jul-10, Jos? Mejuto escribi?:

Show quoted text 10 lines
De: Jos? Mejuto Asunto: [Lazarus] Close button bkClose as "X" A: "General mailing list" Fecha: domingo, 25 de julio de 2010, 18:08 Hello Lazarus-List, In a recent change (#26529) Dmitry changes the code in themes.pas to get a "stock icon" for close kind (a "X") which affects to TBitButton.

I think this is a fallback and should affect only those widgetsets that still do not implement TThemeServices.GetStockImage.

Show quoted text 5 lines
Is this change intented ? If the answer is yes buttons in TBitButton are no more configurable via resources and btn_close.png is not needed anymore.

For a BitBtn of kindbkCustom a stock/themed glyph seems to be used and if you change it, it gets overriden by the stock/themed glyph.

But LCL stock images have still it own use, for example if you don't want to use the default themed glyphs or if the widgetset do not support glyphs or simply you want the same glyphs independent of the current theme/widgetset you can set a user defined function to override the themed glyphs

The way to override is by using the function GetDefaultBitBtnGlyph declared in unit buttons, something like:

[code]
function MyDefaultGlyphs(Kind: TBitBtnKind; var Handled: Boolean):TBitmap;
var
  Glyph: TGraphic;
begin
  case Kind of
    bkClose:
      begin
        Glyph := GetLCLDefaultBtnGlyph(Kind);
        Result := TBitmap.Create;
        Result.assign(Glyph);
        Glyph.Free;
      end
    else
      result := nil;
  end;
  Handled := resultnil;
end;
initialization
  GetDefaultBitBtnGlyph := @MyDefaultGlyphs;

[/code]

Here we are using a LCL stock glyph thru GetLCLDefaultBtnGlyph(Kind), other way, one have to prepare it's own glyphs.

Why only btn_close and no btn_ok and others ?

I think Dmitry could answer this better but I guess it's easier to programmatically paint a "X" than the others :)

Jesus Reyes A.

Reply by email

José Mejuto
to Jesus Reyes: --- El dom 25-jul-10, Jos? Mejuto escribi?: I think this is a fallback and should affect…

Hello Lazarus-List,

you wrote
> In a recent change (#26529) Dmitry changes the code in > themes.pas to > get a "stock icon" for close kind (a "X") which affects to > TBitButton.

JR> I think this is a fallback and should affect only those JR> widgetsets that still do not implement
JR> TThemeServices.GetStockImage.

Yes, it looks as a fallback mechanism, but the problem is the inconsistency, some icons from .pngs and others programatically draw :-?

JR> But LCL stock images have still it own use, for example if JR> you don't want to use the default themed glyphs or if the JR> widgetset do not support glyphs or simply you want the same glyphs JR> independent of the current theme/widgetset you can set a user JR> defined function to override the themed glyphs [...]
JR> initialization
JR> GetDefaultBitBtnGlyph := @MyDefaultGlyphs;

That's a way a bit hard to get the job and quite difficult to implement without knowing all the details, but at least it is possible ;) Maybe a component should be written to handle this customizations.

Best regards, Jos?

Reply by email

José Mejuto
to dmitry boyarintsev: The change of TBitBtn is unintentional, it's just a side effect of theme's stock images…

Hello Lazarus-List,

Monday, July 26, 2010, 7:39:42 AM, you wrote:

Jos? Mejuto wrote
> In a recent change (#26529) Dmitry changes the code in themes.pas to > get a "stock icon" for close kind (a "X") which affects to TBitButton. > Is this change intented ?

db> The change of TBitBtn is unintentional, it's just a side effect of db> theme's stock images drawing.
db> Please fill the bug report.

Done http://bugs.freepascal.org/view.php?id=17037 Thank you.

Best regards, Jos?

Reply by email