Recent

Author Topic: Whats wrong with this code  (Read 3919 times)

BSaidus

  • Hero Member
  • *****
  • Posts: 545
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Whats wrong with this code
« on: May 18, 2021, 11:19:39 pm »
Hello.
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  [Select][+][-]
  1. procedure TfrMain.mnlstPatientsClick(Sender: TObject);
  2. begin
  3.   Form2:= TForm2.Create(Self);
  4.   Form2.Parent := Self;
  5.   Form2.Show;
  6. end;
  7.  

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.
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

BSaidus

  • Hero Member
  • *****
  • Posts: 545
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Whats wrong with this code
« Reply #1 on: May 18, 2021, 11:33:10 pm »
Thank you Jamie,
I will do that.

Quote
what is it lately with people wanting to put forms in forms?
.
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.
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Whats wrong with this code
« Reply #2 on: May 19, 2021, 04:22:25 am »
You said forms in forms, isn't it what TFrame created for?
https://wiki.freepascal.org/Frames
« Last Edit: May 19, 2021, 04:24:44 am by Handoko »

BSaidus

  • Hero Member
  • *****
  • Posts: 545
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Whats wrong with this code
« Reply #3 on: May 19, 2021, 02:52:49 pm »
@jamie
This approche ( you told me ) do not work well.
I use : Lazarus 2.0.10 r63526 FPC 3.2.0 i386-win32-win32/win64
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Whats wrong with this code
« Reply #4 on: May 19, 2021, 11:35:32 pm »
I have no way to do, MDI is deprecated and not implemented well in Lazarus,
TDI is not so easy to use.
I think MDI is better stated as obsolete. Really no new applications are using it, even older apps are being ported away from it if not already (e.g. MS Office, Adobe Acrobat). It's either TDI or docked windows nowadays, depending on your application design.
« Last Edit: May 19, 2021, 11:39:59 pm by Leledumbo »

Blade

  • Full Member
  • ***
  • Posts: 177
Re: Whats wrong with this code
« Reply #5 on: May 20, 2021, 01:20:35 am »
what is it lately with people wanting to put forms in forms?

I think many people are searching for dynamically generated forms.  However, they are likely getting kind of stuck because the most obvious way is to use the IDE, so then you get the standard built form with dynamically generated forms from say a button.  There is also a security element to this, as if you built forms in the standard way, this can be easily seen with resource hacker.  All the .lfm data can be found there.

Completely dynamically generated forms are doable.  The more you do it, probably the more you will get used to it.  But, then you lose a lot of the features of the IDE or the person must cross reference with Object Inspector as to what features or options are available until memorized. 

Possibly a solution for this would be in converting the .lfm data, so that it would be dynamically created by the executable.  I believe there was some type of Delphi utility that did such (for their equivalent of lfm).

BSaidus

  • Hero Member
  • *****
  • Posts: 545
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: Whats wrong with this code
« Reply #6 on: May 22, 2021, 08:52:24 am »
Hi,
And thanks for your responses and help.
Finally I decided to switch to TDI technic, using staff from JVCL ( JvTabBar and JvPageList )
Thank you.
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

 

TinyPortal © 2005-2018