Forum > General

Whats wrong with this code

(1/2) > >>

I have a simple 2 forms, one main and the seconde is called by clicking on a menu item.
in the second form I put a TEdit .
I use this code :

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TfrMain.mnlstPatientsClick(Sender: TObject);begin  Form2:= TForm2.Create(Self);  Form2.Parent := Self;  Form2.Show;end;  
I want that the Form2 will be shown in the frMain .
It works but the Edit on the form can't receive focus .
Can you tel me what wrong with that and why the focus is not showed.

Thanks you.

what is it lately with people wanting to put forms in forms?

Anyways... Use the Windows.SetParent…

windows.SetParent(Form2.Handle, Form1.Handle);

Laz has an issue with this, maybe it should be fixed one day because it works fine in Delphi//

also you need to do this each time you change the border style because laz recreates the window handle

Thank you Jamie,
I will do that.

--- Quote ---what is it lately with people wanting to put forms in forms?
--- End quote ---
I have no way to do, MDI is deprecated and not implemented well in Lazarus,
TDI is not so easy to use.
SDI is in my opinion not aesthetic ( not beautifully ) especially when using showmodal().
If you have other way, i take.

Thank you.

You said forms in forms, isn't it what TFrame created for?

This approche ( you told me ) do not work well.
I use : Lazarus 2.0.10 r63526 FPC 3.2.0 i386-win32-win32/win64


[0] Message Index

[#] Next page

Go to full version