Recent

Author Topic: ImageList on TDataModule  (Read 931 times)

kapibara

  • Hero Member
  • *****
  • Posts: 610
ImageList on TDataModule
« on: September 26, 2020, 11:26:35 pm »
Toolbar on one form and its imagelist on a datamodule seems not to work in Lazarus trunk anymore?

I started a new project and put a toolbar on the main form. Then I added a TDatamodule to hold the TImageList for the toolbar. All icons are visible at designtime, but when the application is started, the toolbar is empty.

Moving the ImageList from the datamodule to the form where the toolbar is makes the icons visible again, but I have always had the imagelist and other non-visual stuff on a datamodule. Can someone confirm that this is not just me making some mistake?

« Last Edit: September 27, 2020, 03:38:35 am by kapibara »
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

korba812

  • Sr. Member
  • ****
  • Posts: 390
Re: ImageList on TDataModule
« Reply #1 on: September 26, 2020, 11:58:53 pm »
It seems that newly created data modules are not created automatically on project startup. Go to project options and in "Forms" section add the data module to "Auto-create forms".

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: ImageList on TDataModule
« Reply #2 on: September 27, 2020, 12:13:49 am »
The data module must be created before the form, look at the .lpr file.

Code: Pascal  [Select][+][-]
  1.   Application.Initialize;
  2.         Application.CreateForm(TDataM, DataM);
  3.         Application.CreateForm(TForm1, Form1);
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

kapibara

  • Hero Member
  • *****
  • Posts: 610
Re: ImageList on TDataModule
« Reply #3 on: September 27, 2020, 01:18:03 am »
You are right! I'm back in business.  :D
Lazarus trunk / fpc 3.2.2 / Kubuntu 22.04 - 64 bit

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: ImageList on TDataModule
« Reply #4 on: September 27, 2020, 03:37:29 am »
Welcome back. 👍
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

 

TinyPortal © 2005-2018