Recent

Author Topic: New forms are put behind main form  (Read 1762 times)

MISV

  • Hero Member
  • *****
  • Posts: 633
New forms are put behind main form
« on: July 18, 2018, 03:29:36 pm »
In Cocoa (possibly also Carbon) new forms seem to be opened behind my main form, so if the user is not aware, he will not noticed the newly opened window (e.g. "about")

Here is my setup. All forms have formstyle fsNormal and I do not use ShowModal... But the code I have should still solve this as far as I know:


Code: Pascal  [Select]
  1.                   if (Application.MainForm <> nil) and (Application.MainForm <> AForm) then
  2.                     begin
  3.                       AForm.PopupMode := pmExplicit;
  4.                       AForm.PopupParent := Application.MainForm;
  5.                     end
  6.                   ;
  7.                   AForm.Show;
  8.                 end
  9.  
  10.  

Shouldn't new forms/windows be placed "ontop"?

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: New forms are put behind main form
« Reply #1 on: July 19, 2018, 12:07:34 pm »
As a temporary fix I will use ShowModal which is a satisfacory solution for me

Thaddy

  • Hero Member
  • *****
  • Posts: 9184
Re: New forms are put behind main form
« Reply #2 on: July 19, 2018, 01:45:18 pm »
Code: Pascal  [Select]
  1.   AForm.Show;
  2.   AForm.BringToFront;
also related to equus asinus.

MISV

  • Hero Member
  • *****
  • Posts: 633
Re: New forms are put behind main form
« Reply #3 on: July 19, 2018, 02:47:11 pm »
I will try - thank you

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2282
    • havefunsoft.com
Re: New forms are put behind main form
« Reply #4 on: July 29, 2018, 10:17:39 pm »
Shouldn't new forms/windows be placed "ontop"?
I am unable to reproduce the issue with the code snippet provided, need an actual project sample.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz