Jump to content

[Pascal Error] E2223 $DENYPACKAGEUNIT 'UniGUIVars' cannot be put into a package


Recommended Posts

  • 2 years later...

Hi There,


I made a project using UniGui based on frames.


I have only one Form, that is my main form, where I create my frames.


All my frames are inherited from one base frame.


Now I want to create packages to keep this frames, so I can update the packages and it be loaded dinamically by the main program.


The problem is that I got stuck on this DENYPACKAGEUNIT 


The answer above is not completelly clear to me, I have no idea what is a Free Form on UniGui.


Anyways, I need it to be a TFrame, and preferably an inherited frame. There is also a need to add a TDataModule.


can I have any direction on this?


Thank YOU!

Link to comment
Share on other sites

I am trying to understand what is happening. 


I have made a minimal package, I have found the FreeForm, never saw it before.


THen I have created a Free Form, changed to Frame and it compiled and generated the package fine.


I have just placed a UniDBGuid and compiled fine also.


So, it seems the problem is the classes that I am using and that I want to convert to this new model.


My project is pretty complex, and I have to tell  you that UniGui is fantastic. I am doing pretty complex software with it. And it is stable.


Now I want to use my main code and menu system as a kind of platform where I can install frames.


However I have no Idea which units is allowed to that. Right now based on this post is says that UniGuiVars should not be added.



Looking further on my code I see that the DataModule was created with the following code:

  UniGUIVars, uniGUIMainModule, MainModule;

function DMMainG: TDMMainG;
  Result := TDMMainG(UniMainModule.GetModuleInstance(TDMMainG));

Since it register the DataModule on the Initialization part.


I wonder if I could remove this dependancy? Since it is a regular Delphi TDataModule, what is the problem creating it directly? 


Each time a frame is created it asks for the DMMainG, to get the DataModule to work.


Right now I have DBISAM components on it and few others that are  not UniGUI related.


So, reviewing what I said, I am trying to convert the current project, based on UniGUI to a package based, on a way that I can intall and load dynamically the packages. 


Seems that TFrame is not a problem, created the Form Free Way. Not Sure if I can use datamodules with no need of the code above. (RegisterModuleClass is defined on UniGuiVars)


I can load dynamicall the BPL and then using my functions register each class imported from the package. Because in this moment I will be in a context that UniGuiVars are allowed.


What you can tell me of all that?


Thank you

Link to comment
Share on other sites



I have found one obscure and almost forgotten unit that was including the MainForm, where uniGuiVars is declared.


I have corrected that, removing the reference to the Main Form and I could generate a package with the Frame, DataModule, etc incluiding the inheritance.


I will be moving now to dynamically open it and load the frames.


However I have removed the TDMMainG(UniMainModule.GetModuleInstance(TDMMainG))


To create the datamodule I am going to test creating it directly. However I believe that the above code is related to get an instance. But is it getting always the same instance of the object? or is it created a new one? What is the problem of calling TDMMainG.Create directly?



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.

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...