Sign in Join

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

Mailing lists / lazarus / 2008-10

TSpeedButton glyph png

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Sebastian Kraft

hello,

since some weeks svn version has problems loading a png image as a glyph on a speedbutton.

Speedbutton.Glyph.loadfromfile('test.png');

gives a runtime error

TApplication.HandleException Wrong image format
Stack trace:
$081AECC4
$080B0A56 TFPIMAGEBITMAP__READSTREAM, line 123 of ./include/fpimagebitmap.inc $080A16FB TRASTERIMAGE__LOADFROMSTREAM, line 434 of ./include/rasterimage.inc $080B0DFC TBITMAP__LOADFROMSTREAM, line 72 of ./include/bitmap.inc $080A1613 TRASTERIMAGE__LOADFROMSTREAM, line 413 of ./include/rasterimage.inc $0809D70D TGRAPHIC__LOADFROMFILE, line 238 of ./include/graphic.inc $080CF74F TMAIN__MUTECLICK, line 2998 of mainform.pas $08179F94 TCONTROL__CLICK, line 2095 of ./include/control.inc $08199CD1 TCUSTOMSPEEDBUTTON__CLICK, line 112 of ./include/speedbutton.inc $0819B40E TCUSTOMSPEEDBUTTON__WMLBUTTONUP, line 788 of ./include/speedbutton.inc $080697E9
$08178008 TCONTROL__PERFORM, line 984 of ./include/control.inc $0816F8AF TWINCONTROL__ISCONTROLMOUSEMSG, line 4163 of ./include/wincontrol.inc $08170B39 TWINCONTROL__WNDPROC, line 4721 of ./include/wincontrol.inc $0823F697 DELIVERMESSAGE, line 3547 of /home/daseeb/devel/lazarus-svn/lcl/interfaces/gtk/g tkproc.inc
$0824AA83 DELIVERMOUSEUPMESSAGE, line 1669 of /home/daseeb/devel/lazarus-svn/lcl/interface s/gtk/gtkcallback.inc
$0824AB80 GTKMOUSEBTNRELEASE, line 1725 of /home/daseeb/devel/lazarus-svn/lcl/interfaces/g tk/gtkcallback.inc

How can I properly load a png file into a speedbutton glyph?

cheers,
sebastian

Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Reply by email

Paul Ishenin
to Sebastian Kraft
Sebastian Kraft wrote 5 lines
hello, since some weeks svn version has problems loading a png image as a glyph on a speedbutton. Speedbutton.Glyph.loadfromfile('test.png');
var
   Png: TPortableNetworkGraphic;
begin
   Png := TPortableNetworkGraphic.Create;
   try
     Png.LoadFromFile('test.png');
     Speedbutton.Glyph := Png;
   finally
     Png.Free;
   end;
end;

Best regards,
Paul Ishenin.

Reply by email

Sebastian Kraft
to Paul Ishenin
Show quoted text 11 lines
Png: TPortableNetworkGraphic; begin Png := TPortableNetworkGraphic.Create; try Png.LoadFromFile('test.png'); Speedbutton.Glyph := Png; finally Png.Free; end; end;

tried this before, but I get

mainform.pas(3004,18) Error: Incompatible type for arg no. 1: Got "TPortableNetworkGraphic", expected "TBitmap"
on Speedbutton.Glyph:=Png;

Sebastian

Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Reply by email

Paul Ishenin
to Sebastian Kraft
Sebastian Kraft wrote 19 lines
> Png: TPortableNetworkGraphic; > begin > Png := TPortableNetworkGraphic.Create; > try > Png.LoadFromFile('test.png'); > Speedbutton.Glyph := Png; > finally > Png.Free; > end; > end; > > tried this before, but I get mainform.pas(3004,18) Error: Incompatible type for arg no. 1: Got "TPortableNetworkGraphic", expected "TBitmap" on Speedbutton.Glyph:=Png;

Ok,

Speedbutton.Glyph.Assign(Png)

Best regards,
Paul Ishenin.

Reply by email

Sebastian Kraft
to Paul Ishenin
Show quoted text 25 lines
Sebastian Kraft wrote: >> Png: TPortableNetworkGraphic; >> begin >> Png := TPortableNetworkGraphic.Create; >> try >> Png.LoadFromFile('test.png'); >> Speedbutton.Glyph := Png; >> finally >> Png.Free; >> end; >> end; >> >> > > tried this before, but I get > > mainform.pas(3004,18) Error: Incompatible type for arg no. 1: Got "TPortableNetworkGraphic", expected "TBitmap" > > on Speedbutton.Glyph:=Png; > Ok, Speedbutton.Glyph.Assign(Png)

Thanks Paul!

Sebastian

Psssst! Schon vom neuen GMX MultiMessenger geh?rt? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

Reply by email