Jump to content

sharing datamodule vcl x unigui


Wilton Ergon

Recommended Posts

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.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...