Recent

Author Topic: MDI Application problem  (Read 220 times)

xtm

  • New Member
  • *
  • Posts: 12
MDI Application problem
« on: November 27, 2020, 10:13:59 am »
Hi,

i have some problem with an MDI application, which i'm worrking on.

I'd also added TPageControl to MDIChild.

I'd made MainFrm as MDI Form, Child as MDI Child. I've implemented such code:

Code: Pascal  [Select][+][-]
  1. KontaFrm:=TKontaFrm.Create(Self);
  2.   KontaFrm.Parent:=MainFrm.MainPanel;
  3.   {$ifdef WINDOWS}
  4.   KontaFrm.Top:= 0;
  5.   KontaFrm.Left:= 0;
  6.   KontaFrm.Width:= MainFrm.MainPanel.Width - 4;
  7.   KontaFrm.Height:= MainFrm.MainPanel.Height - 4;
  8.   {$else}
  9.   KontaFrm.Align:= alClient;
  10.   {$endif}
  11.   if eKmPasek.Text<>'' then KontaFrm.Konta.Text:=eKmPasek.Text;
  12.   KontaFrm.NazwaOkna;
  13.   KontaFrm.PKFiltr.Text:=KontaFrm.Konta.Text;
  14.   KontaFrm.DKFiltr.Text:=KontaFrm.Konta.Text;
  15.   KontaFrm.OpFiltr.Text:=KontaFrm.Konta.Text;
  16.   KontaFrm.Strony.ActivePage:=KontaFrm.Operacje;
  17.   eKmPasek.Clear;
  18.   KontaFrm.Show;
  19.   KontaFrm.SetFocus;

Problem is, that i can select, switch, focus on Edits, Cobmobox fields with only TAB button. It's no reaction on mouse clicks. Left click doesn't get control active, and right click runs no system popupmenu. There is simply no reaction on mouse clicks.

Where can be a problem? Thank's for all help.

xtm

  • New Member
  • *
  • Posts: 12
Re: MDI Application problem
« Reply #1 on: November 27, 2020, 02:52:56 pm »
It was not really elegant, but still only way, that's worked.

I've added OnClick event with SetFocus method to every Control, which was on MDIChild (luckily there was not much of it).

If anyone will have better solution, a'm all ears.

Thaddy

  • Hero Member
  • *****
  • Posts: 10684
Re: MDI Application problem
« Reply #2 on: November 27, 2020, 03:25:40 pm »
Just a remark: MDI applications are deprecated (by microsoft) for the past 20 years and never worked well with Lazarus.
I suggest to re-engineer to an SDI lay-out. Unless you want your software to have an old school look deliberately.
« Last Edit: November 27, 2020, 03:27:43 pm by Thaddy »

 

TinyPortal © 2005-2018