Recent

Author Topic: Imagelist problems  (Read 5421 times)

Reenen

  • New Member
  • *
  • Posts: 29
    • http://daringapprentice.wikispaces.com
Imagelist problems
« on: February 14, 2008, 06:35:46 am »
I wanted to "share" my icons for my application.  So I created a Datamodule, and placed an Imagelist there.

I then loaded the images into the imagelist at designtime.

When I run my application, I assign the images to my buttons at creation.

Which works... The mainform has the speed/bit buttons with their images.  But then when I show form2 (which also has buttons with the same icon) the application crashes due to access violation.

Any help?

During mainform.create(...)
Code: [Select]

    DataModule1.ImageList1.ShareImages := true;
    DataModule1.ImageList1.GetBitmap(0, btnUntapAll.Glyph) ;
    DataModule1.ImageList1.GetBitmap(1, btnDrawCard.Glyph) ;
    DataModule1.ImageList1.GetBitmap(2, btnCreateToken.Glyph) ;
    DataModule1.ImageList1.GetBitmap(3, btnLifeDown.Glyph) ;
    DataModule1.ImageList1.GetBitmap(4, btnLifeAdd.Glyph) ;
    DataModule1.ImageList1.GetBitmap(5, btnSetLife.Glyph) ;
    DataModule1.ImageList1.GetBitmap(6, btnNextPlayer.Glyph) ;


In my other form (in my "formshow" procedure)
Code: [Select]

  if not initialized then begin
    DataModule1.ImageList1.GetBitmap(0, btnUntapAll.Glyph) ;
    DataModule1.ImageList1.GetBitmap(1, btnDrawCard.Glyph) ;
    DataModule1.ImageList1.GetBitmap(2, btnCreateToken.Glyph) ;
    DataModule1.ImageList1.GetBitmap(6, btnNextPlayer.Glyph) ;
  end;
[/code]

 

TinyPortal © 2005-2018