Lazarus

Programming => General => Topic started by: kapibara on September 26, 2020, 11:26:35 pm

Title: ImageList on TDataModule
Post by: kapibara 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?

Title: Re: ImageList on TDataModule
Post by: korba812 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".
Title: Re: ImageList on TDataModule
Post by: GAN 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);
Title: Re: ImageList on TDataModule
Post by: kapibara on September 27, 2020, 01:18:03 am
You are right! I'm back in business.  :D
Title: Re: ImageList on TDataModule
Post by: GAN on September 27, 2020, 03:37:29 am
Welcome back. 👍
TinyPortal © 2005-2018