Solved

showing a dll form in a panel in main app

Posted on 2004-03-22
11
945 Views
Last Modified: 2011-04-14
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.Handle).ParentWindow := MainPanel.Handle;
ShowDllIRForm(MainForm.Handle).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;
0
Comment
Question by:Darth_helge
  • 2
  • 2
  • 2
  • +4
11 Comments
 
LVL 27

Assisted Solution

by:kretzschmar
kretzschmar earned 100 total points
ID: 10648425
is your dllForm borderless??
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 10648463
yes
0
 
LVL 5

Accepted Solution

by:
delphized earned 100 total points
ID: 10649571
I tried a similar way to do things, but I had a lot of strange problems. So I decided that you can't do things that are not supposed to be done with Delphi. I think this is due to Borland attitude towards the encapsulation of windows functions, that sometime is done in a odd and stupid way (see printer.pas for reference).

anyway goodluck ;-P
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 17

Assisted Solution

by:geobul
geobul earned 100 total points
ID: 10655676
Hi,

If it's suitable to you I would suggest using packages instead of dlls.

http://community.borland.com/article/0,1410,27178,00.html

Regards, Geo
0
 
LVL 11

Assisted Solution

by:shaneholmes
shaneholmes earned 100 total points
ID: 10663403
0
 

Assisted Solution

by:michaenh
michaenh earned 100 total points
ID: 10666736
Hi

How to support the keyboard for forms that are stored in a DLL and are docked on a control of the application? It seem that it can not get focus on any components or use the Tab, Arrow key in the dll form that have been docked or used as show instead of showmodal?

One could use pakages or frames instead of dll(as GEO mention.. ).
ex. frames:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20431534.html

I am also interested if anyone have any solution to the dll's problem in delphi.
kretzschmar, GEO.. :)

cheers,
mha
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 10666788
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 ;-)
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 10667009
the borderstyle is bsnone and the formstyle is fsnormal
0
 
LVL 1

Expert Comment

by:Extase
ID: 11282039
the use of SetParent API could solve the focus & keys problems,
SetParent(DLLForm.Handle, MainPanel.Handle);

0
 

Expert Comment

by:michaenh
ID: 11293598
Hi I believe I have tried setparent...

Could you show a small example of the code.. ?
Have you tried it?

cheers,
mha
0
 
LVL 1

Expert Comment

by:Extase
ID: 11295839
here's some snippets from a project i'm working on

IProjectMgr = interface
  ['{B5427304-4D62-478A-99DF-3228F2185038}']
   function CreatePluginForm(const PluginClass:TPluginFormClass;const AOwner:TComponent;
                                             const AParent:TWinControl;const Sender:TObject):TPluginForm;
end;

IProjectMgr is implemented in TProjectMgrForm as follows:

function TProjectMgrForm.CreatePluginForm(const PluginClass:TPluginFormClass;const AOwner:TComponent;
                                             const AParent:TWinControl;const Sender:TObject):TPluginForm;
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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
creating threads in delphi 1 131
Delphi: Connect to running MS Outlook 4 118
PHP preg_replace code convert to Delphi 14 66
Firemonkey BASS_Init into a thread 17 30
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question