Forum > Unix

[Solved] Bug with Cocoa application-delegate class?

(1/1)

AlexTP:
MacOS 10.8 and 11.x.
I see a regression in CudaText,--  app don't get TForm.OnDropFiles when I run the editor from Finder (dbl click on text file or do 'open with'). App runs but don't get OnDropFiles.
I added the Application.MessageBox here:

lazarus/lcl/interfaces/cocoa/cocoaobject.inc

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TAppDelegate.application_openFiles(sender: NSApplication; filenames: NSArray);var  lFiles: array of string;  lNSStr: NSString;  i: Integer;begin  SetLength(lFiles, filenames.count);  for i := 0 to filenames.count-1 do  begin    lNSStr := NSString(filenames.objectAtIndex(i));    lFiles[i] := NSStringToString(lNSStr);  end;  Application.MessageBox('App openFiles, cnt: '+IntTOstr(filenames.count), 'Cocoa'); //debug  Application.IntfDropFiles(lFiles);  if Application.MainForm<>nil then    Application.MainForm.IntfDropFiles(lFiles);end; 
and msgbox is not called! Maybe a regression in FPC?
This procedure is in the cocoa/cocoaint.pas:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  TAppDelegate = objcclass(NSObject, NSApplicationDelegateProtocol)  public    orderArray : PWinLevelOrderArray;    orderArrayCount : Integer;    procedure application_openFiles(sender: NSApplication; filenames: NSArray); 
I do cross compile from Linux x64 to Mac.
user@PC:~/fpcupdeluxe/fpcupdeluxe32/fpc/bin/x86_64-linux$ ./fpc
Free Pascal Compiler version 3.2.3-660-g9b2ba834a6 [2022/08/18] for x86_64
It is 'fixes' branch.

AlexTP:
Sorry, problem seems not in FPC, 3.2 release shows the same.

Navigation

[0] Message Index

Go to full version