Darth_helge
asked on
showing a dll form in a panel in main app
My form A will call another TCustomForm from a DLL and place it on a panel in the main program.
But when I do this my dbgrids don't behave like they should. I can't navigate with my up_key and down_key.
I know that if rewrite the code and shows the tcustomform in the dll as showmodal the dbgrids behave perfect.
How can I do this when the form is hooked to the panel in the mainform too?
In Main (where I call the form):
ShowDllIRForm(MainForm.Han dle).Paren tWindow := MainPanel.Handle;
ShowDllIRForm(MainForm.Han dle).Show;
In DLL (returns the form):
function ShowDllIRForm(hApp: THandle): TCustomForm; stdcall;
begin
Application.Handle := hApp;
if not assigned(IRForm) then
IRForm := TIRForm.Create(Application );
result := IRForm;
end;
But when I do this my dbgrids don't behave like they should. I can't navigate with my up_key and down_key.
I know that if rewrite the code and shows the tcustomform in the dll as showmodal the dbgrids behave perfect.
How can I do this when the form is hooked to the panel in the mainform too?
In Main (where I call the form):
ShowDllIRForm(MainForm.Han
ShowDllIRForm(MainForm.Han
In DLL (returns the form):
function ShowDllIRForm(hApp: THandle): TCustomForm; stdcall;
begin
Application.Handle := hApp;
if not assigned(IRForm) then
IRForm := TIRForm.Create(Application
result := IRForm;
end;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
well,
i myelf didn't done a form in a dll,
therefore i can't point directly to thats it.
i know there are problems to embed bordered forms,
thats why i asked, if it is a borderless form.
as it is a borderless form, i'm out of ideas
will do a bit recherche
meikl ;-)
i myelf didn't done a form in a dll,
therefore i can't point directly to thats it.
i know there are problems to embed bordered forms,
thats why i asked, if it is a borderless form.
as it is a borderless form, i'm out of ideas
will do a bit recherche
meikl ;-)
ASKER
the borderstyle is bsnone and the formstyle is fsnormal
the use of SetParent API could solve the focus & keys problems,
SetParent(DLLForm.Handle, MainPanel.Handle);
SetParent(DLLForm.Handle, MainPanel.Handle);
Hi I believe I have tried setparent...
Could you show a small example of the code.. ?
Have you tried it?
cheers,
mha
Could you show a small example of the code.. ?
Have you tried it?
cheers,
mha
here's some snippets from a project i'm working on
IProjectMgr = interface
['{B5427304-4D62-478A-99DF -3228F2185 038}']
function CreatePluginForm(const PluginClass:TPluginFormCla ss;const AOwner:TComponent;
const AParent:TWinControl;const Sender:TObject):TPluginFor m;
end;
IProjectMgr is implemented in TProjectMgrForm as follows:
function TProjectMgrForm.CreatePlug inForm(con st PluginClass:TPluginFormCla ss;const AOwner:TComponent;
const AParent:TWinControl;const Sender:TObject):TPluginFor m;
begin
Result:=PluginClass.Create (AOwner) as TPluginForm;
with Result do
begin
BorderStyle:=bsNone;//can be set at design time
Windows.SetParent(Handle, AParent.Handle);
Align:=alClient;
Show;
end;//with
end;
the Application(Host Application) is passed to the plugin DLL in the exported register procedure, so the plugin can get the interface IProjectMgr and calls CreatePluginForm passing to the Host App the PluginClass,and the creation of the pluginform is handled in the host application.
//still have only one problem ,. the align property of child controls in the plugin form, does'nt work correctly.
//everything else is OK
IProjectMgr = interface
['{B5427304-4D62-478A-99DF
function CreatePluginForm(const PluginClass:TPluginFormCla
const AParent:TWinControl;const Sender:TObject):TPluginFor
end;
IProjectMgr is implemented in TProjectMgrForm as follows:
function TProjectMgrForm.CreatePlug
const AParent:TWinControl;const Sender:TObject):TPluginFor
begin
Result:=PluginClass.Create
with Result do
begin
BorderStyle:=bsNone;//can be set at design time
Windows.SetParent(Handle, AParent.Handle);
Align:=alClient;
Show;
end;//with
end;
the Application(Host Application) is passed to the plugin DLL in the exported register procedure, so the plugin can get the interface IProjectMgr and calls CreatePluginForm passing to the Host App the PluginClass,and the creation of the pluginform is handled in the host application.
//still have only one problem ,. the align property of child controls in the plugin form, does'nt work correctly.
//everything else is OK
ASKER