Recent

Author Topic: (SOLVED) OSX and ShowModal problema  (Read 4571 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
(SOLVED) OSX and ShowModal problema
« on: July 28, 2016, 08:14:17 am »
Hello guys. I have a question. On Mac systems if I open a modal form and then execute a ShowMessage, the message goes into the background because of the modal form and then the program stops. How can I overcome this problem? There is some property somewhere that avoids me this problem?

Thank you
« Last Edit: July 28, 2016, 02:49:19 pm by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: OSX and ShowModal problema
« Reply #1 on: July 28, 2016, 01:45:31 pm »
Sounds like this longtime Lazarus bug:

http://mantis.freepascal.org/view.php?id=29694

Applying the patch and rebuilding LCL should fix it. Rebuild Laz too since it's affected by this bug as well.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: OSX and ShowModal problema
« Reply #2 on: July 28, 2016, 02:15:31 pm »
Thank you, with what command I apply the patch?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: OSX and ShowModal problema
« Reply #3 on: July 28, 2016, 02:23:22 pm »
A text editor?

It's just a few lines that need to be commented out in one file.

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: OSX and ShowModal problema
« Reply #4 on: July 28, 2016, 02:35:09 pm »
This is patch
Code: Pascal  [Select][+][-]
  1. Index: lcl/interfaces/carbon/carbonwsforms.pp
  2. ===================================================================
  3. --- lcl/interfaces/carbon/carbonwsforms.pp      (revision 51666)
  4. +++ lcl/interfaces/carbon/carbonwsforms.pp      (working copy)
  5. @@ -141,19 +141,11 @@
  6.   ------------------------------------------------------------------------------}
  7.  class function TCarbonWSCustomForm.CreateHandle(const AWinControl: TWinControl;
  8.    const AParams: TCreateParams): TLCLIntfHandle;
  9. -var
  10. -  frm : TCustomForm;
  11.  begin
  12.    if IsFormDesign(AWinControl) then
  13.      Result := TLCLIntfHandle(TCarbonDesignWindow.Create(AWinControl, AParams))
  14.    else
  15.      Result := TLCLIntfHandle(TCarbonWindow.Create(AWinControl, AParams));
  16. -  frm:=TCustomForm(AWinControl);
  17. -  if Assigned(frm) then
  18. -  begin
  19. -    if (AParams.WndParent<>0) and ((AParams.Style and WS_CHILD) = 0) then
  20. -      SetWindowGroup(TCarbonWindow(Result).Window, GetWindowGroupOfClass(kHelpWindowClass));
  21. -  end;
  22.  end;
  23.  
  24.  {------------------------------------------------------------------------------
  25.  
  26.  

this is my code

Code: Pascal  [Select][+][-]
  1. class function TCarbonWSCustomForm.CreateHandle(const AWinControl: TWinControl;
  2.   const AParams: TCreateParams): TLCLIntfHandle;
  3. var
  4.   frm : TCustomForm;
  5. begin
  6.   if IsFormDesign(AWinControl) then
  7.     Result := TLCLIntfHandle(TCarbonDesignWindow.Create(AWinControl, AParams))
  8.   else
  9.     Result := TLCLIntfHandle(TCarbonWindow.Create(AWinControl, AParams));
  10.   frm:=TCustomForm(AWinControl);
  11.   if Assigned(frm) then
  12.   begin
  13.     if (AParams.WndParent<>0) and ((AParams.Style and WS_CHILD) = 0) then
  14.       SetWindowGroup(TCarbonWindow(Result).Window, GetWindowGroupOfClass(kHelpWindowClass));
  15.   end;
  16. end;
  17.  
  18.  

How do I change my code?
 - on patches mean that I have to delete the line?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: OSX and ShowModal problema
« Reply #5 on: July 28, 2016, 02:39:00 pm »
Correct. Comment out or delete the last 6 lines starting with "frm:=...".

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: (SOLVED) OSX and ShowModal problema
« Reply #6 on: November 02, 2016, 04:06:59 pm »
Hello Phil, sorry if I reopen an old discussion, but the problem is very similar.

I have the same problem with regard to all the times that I have to choose a file. For example when I have to load an image into a TImageList. It hangs around because the choice of the file is modal, but so is the screen from which it is invoked.

Do you have any suggestions in this regard?

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

 

TinyPortal © 2005-2018