View Issue Details

IDProjectCategoryView StatusLast Update
0001834JEDI VCL00 JVCL Componentspublic2004-06-08 04:17
ReporterwdonkerAssigned Touser72 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0001834: TJvTransparentButton only supports square images
DescriptionTJvtransparentButton has a property NumGlyphs, which has no meaning in the current implementation.
Cause: procedure GlyphChanged overrides NumGlyphs with a value calculated from the Height and Width of the Glyph.
Moreover this calculation assumes the Glyps are square!ssume, assuming
Additional InformationProposed fix:

procedure TJvTransparentButton.SetNumGlyphs(Value: TNumGlyphs);
begin
  if FNumGlyphs <> Value then
  begin
    FNumGlyphs := Value;
// next line added so the FImList is rebuilt
    GlyphChanged(Self);
    Invalidate;
  end;
end;
procedure TJvTransparentButton.GlyphChanged(Sender: TObject);
var
  GlyphNum: Integer;
begin
  Invalidate;
// no need to recalculate NumGlyphs anymore, so
  these lines are no longer needed
// GlyphNum := 1;
// if (Glyph <> nil) and (Glyph.Height > 0) then
// begin
// if Glyph.Width mod Glyph.Height = 0 then
// begin
// GlyphNum := Glyph.Width div Glyph.Height;
// if GlyphNum > 4 then
// GlyphNum := 1;
// SetNumGlyphs(GlyphNum);
// end;
    AddGlyphs(Glyph, Glyph.TransparentColor {Glyph.Canvas.Pixels[0,Height]}, GlyphNum);
  end;
end;
TagsNo tags attached.

Activities

user72

2004-06-08 04:17

  ~0004498

Fixed in CVS, although I've changed it slightly so the number of glyphs are calculated when a new image is assigned.

I've also fixes a Down bug (TJvTransparentButton2 didn't draw a pattern when the button was down) and published AllowAllup and GroupIndex (so you can use the Down property...)

Issue History

Date Modified Username Field Change
2004-06-04 14:54 wdonker New Issue
2004-06-08 02:41 user72 Status new => assigned
2004-06-08 02:41 user72 Assigned To => user72
2004-06-08 04:17 user72 Status assigned => resolved
2004-06-08 04:17 user72 Resolution open => fixed
2004-06-08 04:17 user72 Note Added: 0004498