Re: [Lazarus] MDI - working implementation !?

2014-10-26 Thread zeljko

On 10/26/2014 05:22 PM, Herwig Niemeyer wrote:

I hope, i found a workaround to the problems with MDIChildren in a
MainForm/MDIForm. In my testprogram it looks all okay to me.
But before i load up another patch perhaps someone does his/her own
tests to make sure all is working fine.
https://dl.dropboxusercontent.com/u/24228536/projectMDIText.zip
Herwig


I've seen what are you doing in your project. It's not real mdi 
implementation (you're using ParentWindow, and that won't work as 
expected even on windows), and that differs from normal mdi usage in 
Delphi and Lazarus with qt widgetset.

Win32 widgetset must implement basic stuff.
How it works under linux gtk2 ?

zeljko


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MDI - working implementation !?

2014-10-26 Thread Herwig Niemeyer

I hope, i found a workaround to the problems with MDIChildren in a MainForm/MDIForm. In my testprogram it looks all okay to me.

But before i load up another patch perhaps someone does his/her own tests to make sure all is working fine.

 

https://dl.dropboxusercontent.com/u/24228536/projectMDIText.zip

 

Herwig


 


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MDI - working implementation !?

2014-10-26 Thread Herwig Niemeyer

I provided a patch now. Hope all is ok because this is my first time to work in the community.

Now that I have built a testing-program (depending on built-in MDI methods or using a patched customform.inc) to check all the possibilities i can think of, it shows that inside the main/MDI form there are problems to get the correct zOrder. Therefore the function activeMDIChild does not work correctly. ( In my old Delphi-program i used MDIForm outside the main Form)


Link to my testprogram: https://dl.dropboxusercontent.com/u/24228536/projectMDITest.zip

 

Herwig

 


Gesendet: Sonntag, 26. Oktober 2014 um 08:18 Uhr
Von: zeljko 
An: "Lazarus mailing list" 
Betreff: Re: [Lazarus] MDI - working implementation !?

On 10/26/2014 02:57 AM, Kostas Michalopoulos wrote:
> Very interesting, i was actually looking into implementing MDI (for
> Windows... AFAIK the Qt backend already has MDI support).
>
> Although from a quick look at the code, it doesn't seem to do that, does
> it? It looks like it only checks the form type, but still the forms are
> top level, not under an MDI client window inside the main/MDI form.

That's why I said to Herwig to provide patch. Let we see what it does.
But IMO, win32 need ws implementation, part where mdiarea must be
created and also mdichild handle.

zeljko

>
> On Sat, Oct 25, 2014 at 10:25 AM, zeljko 
> > wrote:
>
> On 10/24/2014 02:03 PM, Herwig Niemeyer wrote:
>
> On transcribing an old Delphi-Program to a Lazarus-program i was
> in need
> do have working MDI-functions.
> I tried to implement them in customform.inc and they work fine
> with my
> program and in my environment.
> There are still some problematic spots in the code and i would
> appreciate comments/solutions for them.
> regards
>
>
> Please, learn howto make patch, open an issue about it at lazarus
> bug tracker and attach patch.
> I'll commit it after review. btw. what is your environment ?
> widgetset ? OS ?
>
> zeljko
>
>
> --
> _
> Lazarus mailing list
> Lazarus@lists.lazarus.__freepascal.org
> 
> http://lists.lazarus.__freepascal.org/mailman/__listinfo/lazarus
> <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
>
>
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MDI - working implementation !?

2014-10-26 Thread zeljko

On 10/26/2014 02:57 AM, Kostas Michalopoulos wrote:

Very interesting, i was actually looking into implementing MDI (for
Windows... AFAIK the Qt backend already has MDI support).

Although from a quick look at the code, it doesn't seem to do that, does
it? It looks like it only checks the form type, but still the forms are
top level, not under an MDI client window inside the main/MDI form.


That's why I said to Herwig to provide patch. Let we see what it does.
But IMO, win32 need ws implementation, part where mdiarea must be 
created and also mdichild handle.


zeljko



On Sat, Oct 25, 2014 at 10:25 AM, zeljko mailto:zel...@holobit.net>> wrote:

On 10/24/2014 02:03 PM, Herwig Niemeyer wrote:

On transcribing an old Delphi-Program to a Lazarus-program i was
in need
do have working MDI-functions.
I tried to implement them in customform.inc and they work fine
with my
program and in my environment.
There are still some problematic spots in the code and i would
appreciate comments/solutions for them.
regards


Please, learn howto make patch, open an issue about it at lazarus
bug tracker and attach patch.
I'll commit it after review. btw. what is your environment ?
widgetset ? OS ?

zeljko


--
_
Lazarus mailing list
Lazarus@lists.lazarus.__freepascal.org

http://lists.lazarus.__freepascal.org/mailman/__listinfo/lazarus





--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MDI - working implementation !?

2014-10-25 Thread Kostas Michalopoulos
Very interesting, i was actually looking into implementing MDI (for
Windows... AFAIK the Qt backend already has MDI support).

Although from a quick look at the code, it doesn't seem to do that, does
it? It looks like it only checks the form type, but still the forms are top
level, not under an MDI client window inside the main/MDI form.

On Sat, Oct 25, 2014 at 10:25 AM, zeljko  wrote:

> On 10/24/2014 02:03 PM, Herwig Niemeyer wrote:
>
>> On transcribing an old Delphi-Program to a Lazarus-program i was in need
>> do have working MDI-functions.
>> I tried to implement them in customform.inc and they work fine with my
>> program and in my environment.
>> There are still some problematic spots in the code and i would
>> appreciate comments/solutions for them.
>> regards
>>
>
> Please, learn howto make patch, open an issue about it at lazarus bug
> tracker and attach patch.
> I'll commit it after review. btw. what is your environment ? widgetset ?
> OS ?
>
> zeljko
>
>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] MDI - working implementation !?

2014-10-25 Thread zeljko

On 10/24/2014 02:03 PM, Herwig Niemeyer wrote:

On transcribing an old Delphi-Program to a Lazarus-program i was in need
do have working MDI-functions.
I tried to implement them in customform.inc and they work fine with my
program and in my environment.
There are still some problematic spots in the code and i would
appreciate comments/solutions for them.
regards


Please, learn howto make patch, open an issue about it at lazarus bug 
tracker and attach patch.
I'll commit it after review. btw. what is your environment ? widgetset ? 
OS ?


zeljko


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] MDI - working implementation !?

2014-10-24 Thread Herwig Niemeyer
On transcribing an old Delphi-Program to a Lazarus-program i was in need do have working MDI-functions.
I tried to implement them in customform.inc and they work fine with my program and in my environment.
There are still some problematic spots in the code and i would appreciate comments/solutions for them.

 

regards

H. Niemeyer{--
  Method:  TCustomForm.ActiveMDIChild
  Params:  None
  Returns: Nothing

  Returns currently active MDI child form of self.
  Valid result is returned only when Self FormStyle = fsMDIForm or fsMDIChild,
  otherwise Result is nil.
 --}
function TCustomForm.ActiveMDIChild: TCustomForm;
var actMdiChild : TCustomForm;
k   : integer;
begin
  Result := nil;
(*  if not (FormStyle in [fsMDIForm, fsMDIChild]) then
exit;
  if HandleAllocated and not (csDesigning in ComponentState) then
Result := TWSCustomFormClass(WidgetSetClass).ActiveMDIChild(Self);   *)

  if (csDesigning in ComponentState) or not(FormStyle in [fsMDIForm, fsMDIChild]) then
exit;
  if HandleAllocated then
Result := TWSCustomFormClass(WidgetSetClass).ActiveMDIChild(Self);

  if Result=nil then
begin
  k := 0;
  while (kAIndex) do
   begin
 k := k+1;
 if (Components[k] is TCustomForm) and (TCustomForm(Components[k]).FormStyle in [fsMDIForm, fsMDIChild]) then index:=index+1;
   end;
  if (k fsMDIForm) then
exit;
  if HandleAllocated and not (csDesigning in ComponentState) then
TWSCustomFormClass(WidgetSetClass).Cascade(Self);  *)
  if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then
exit;
  if HandleAllocated
then CascadeOk:=TWSCustomFormClass(WidgetSetClass).Cascade(Self)
else CascadeOk:=false;

  if CascadeOk then exit;
  visMDIList := TList.Create;
  for k := screen.CustomFormZOrderCount-1 downto 0 do   // keep old order; activeMDIChild (index=0) in front;
   begin
 temp := Screen.CustomFormsZOrdered[k];
 if (temp.FormStyle in [fsMDIForm, fsMDIChild]) and (temp.Owner=self)
 and temp.Visible and (temp.WindowState<>wsMinimized)   // don't cascade non-visible or minimized MDIChilds ?
   then visMdiList.Add(temp);
   end;
  if visMdiList.Count>0 then
begin
  temp:=TCustomForm(visMdiList.Items[0]);
  comp:=temp.Parent;
  if (comp<>nil) and (comp is TCustomForm)
   then r := TCustomForm(comp).ClientRect
   else r := Screen.WorkAreaRect;// screen.DesktopRect;
   w:=(r.right - r.left)*3 div 4;// no spezial reason for this value
   h:=(r.bottom - r.top)*3 div 4;
   if (w>0) and (h>0) then
 for k:=0 to visMdiList.Count-1 do
   begin
 temp:=TCustomForm(visMdiList.Items[k]);
 temp.SetBounds(r.left + k*offsetX, r.top + k*offsetY, w, h);
   end;
end;
  visMDIList.Free;
end;

{--
  Method: TForm.Next
  Params:  None
  Returns: Nothing

  Activates the next child MDI form (fsMDIChild) in the form sequence.
  Use Next to change the active child form of an MDI parent.
  If calling of Next comes to the end of count it restarts and activates
  first dsMDIChild in sequence.
  The Next method applies only to forms with FormStyle = fsMDIForm.
 --}
procedure TForm.Next;
var k   : integer;
success : boolean;
Comp: TComponent;
nextMDIChild, actMDIChild : TCustomForm;
begin
 (* if (FormStyle <> fsMDIForm) then
exit;
  if HandleAllocated and not (csDesigning in ComponentState) then
TWSCustomFormClass(WidgetSetClass).Next(Self);  *)
  if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then
exit;
  if HandleAllocated
then success:=TWSCustomFormClass(WidgetSetClass).Next(Self)
else success:=false;

  if success then exit;// successful handling by WidgetSetClass
  actMDIChild := ActiveMDIChild;
  if actMDIChild=nil then exit;//no active MDIChild

  k := -1; nextMDIChild := nil;
  //Don't use Screen.CustomForms as positions in that list are changed, when activating a form
  While (k fsMDIForm) then
exit;
  if HandleAllocated and not (csDesigning in ComponentState) then
TWSCustomFormClass(WidgetSetClass).Previous(Self);*)
  if (FormStyle <> fsMDIForm) or (csDesigning in ComponentState) then
exit;
  if HandleAllocated then
success:=TWSCustomFormClass(WidgetSetClass).Previous(Self)
else success:=false;

  if success then exit;// successful handling by WidgetSetClass
  actMDIChild := ActiveMDIChild;
  if actMDIChild=nil then exit;// no active MDIChild
  k := -1;
  PrevMDIChild := nil; Comp := nil; lastMDIChild := nil;
  //Don't use Screen.CustomForms as positions in that list are changed, when act