Wilton Ergon Posted April 5, 2018 Share Posted April 5, 2018 I created a datamodule and with some directives I want to share it with a vcl application, does it work? datamodule was created with the unigui assistant. sample: unit udmMODELO; interface uses SysUtils, Classes; type TdmMODELO = class(TDataModule) private { Private declarations } public { Public declarations } end; {$IFDEF is_UNIGUI} function dmMODELO: TdmMODELO; {$ENDIF} {$IFDEF is_VCL} var dmMODELO: TdmMODELO; {$ENDIF} implementation {$R *.dfm} {$IFDEF is_VCL} uses uFuncoesCompartilhadas,ufrmmain,ufrmconexao,umensagens,MainModule; {$ENDIF} {$IFDEF is_UNIGUI} uses UniGUIVars,uniGUIMainModule,uFuncoesCompartilhadas,ufrmmain,ufrmconexao,umensagens,MainModule; {$ENDIF} {$IFDEF is_UNIGUI} function dmMODELO: TdmMODELO; begin Result := TdmMODELO(frmconexao.GetModuleInstance(TdmMODELO)); end; {$ENDIF} {$IFDEF is_UNIGUI} initialization RegisterModuleClass(TdmMODELO); {$ENDIF} end. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.