Recent

Author Topic: ImageList on TDataModule  (Read 366 times)

kapibara

  • Hero Member
  • *****
  • Posts: 532
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.0.4 / Debian 10 - 64 bit

korba812

  • Full Member
  • ***
  • Posts: 142
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: 305
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 - Sqlite 3.32.3

https://gitlab.com/users/GAN__/projects

kapibara

  • Hero Member
  • *****
  • Posts: 532
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.0.4 / Debian 10 - 64 bit

GAN

  • Sr. Member
  • ****
  • Posts: 305
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 - Sqlite 3.32.3

https://gitlab.com/users/GAN__/projects

 

TinyPortal © 2005-2018