Recent

Author Topic: Designer Does Not See Datamodule  (Read 522 times)

mcwbr

  • New Member
  • *
  • Posts: 10
Designer Does Not See Datamodule
« on: September 08, 2022, 03:24:00 pm »
So far as I know, the only thing to do in order to get the designer to see a datamodule, such that datasources become available to the data aware controls and can be assigned via the Object Inspector, is to add the data module to the uses clause of the form's interface.

But when I do this, the datamodule does not appear in the Object Inspector's drop-down list for the datasource of a control and I cannot simply type-in: DataModuleX.SomeDatasource without causing an error.

The project compiles. I can assign the datasource to a dbEdit control at run time. I have tried closing and reloading the project. What have I failed to do? Is something else necessary for the designer to see the datamodule?


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10402
  • FPC developer.
Re: Designer Does Not See Datamodule
« Reply #1 on: September 08, 2022, 03:51:59 pm »
Add the module to the project.

mcwbr

  • New Member
  • *
  • Posts: 10
Re: Designer Does Not See Datamodule
« Reply #2 on: September 08, 2022, 06:00:17 pm »
Thanks for the quick reply, but the datamodule is part of the project.

wp

  • Hero Member
  • *****
  • Posts: 10298
Re: Designer Does Not See Datamodule
« Reply #3 on: September 08, 2022, 06:13:23 pm »
The datamodule must be loaded into the IDE in order to see it in the DataSource dropdown of the data-aware components (after loading, you may have to press F12 to activate it in the designer).

mcwbr

  • New Member
  • *
  • Posts: 10
Re: Designer Does Not See Datamodule
« Reply #4 on: September 08, 2022, 06:16:13 pm »
Aha! The problem is you don't want the datamodule's unit in either uses clause, interface or implementation. The dm's instance variable is global.

I removed the reference to the datamodule from the form's uses clause and the problem is solved.

dseligo

  • Hero Member
  • *****
  • Posts: 814
Re: Designer Does Not See Datamodule
« Reply #5 on: September 08, 2022, 09:58:27 pm »
Aha! The problem is you don't want the datamodule's unit in either uses clause, interface or implementation. The dm's instance variable is global.

I removed the reference to the datamodule from the form's uses clause and the problem is solved.

Strange. I always put datamodule to uses clause and never had problems with that.

mcwbr

  • New Member
  • *
  • Posts: 10
Re: Designer Does Not See Datamodule
« Reply #6 on: September 09, 2022, 02:54:30 am »
Yes it is, and I have not been able to repeat it. Once I removed the reference to the datamodule, the Object Inspector's drop-down was populated. When I put it back again, it remained populated.

I'd be left with doubting what I saw except that I saw it repeatedly before posting here, restarting the IDE, doing full compiles, with the data module in either uses clause all the while. Then I removed the reference to the dm and all became well, and stayed well after I put it back again.

I don't blame you for wanting to know what I'm smoking.

 

TinyPortal © 2005-2018