Recent

Author Topic: TComboBox Causing Delay When Compiled for 64 Bit With LCLWidgetType:=Cocoa  (Read 3490 times)

emhartner

  • Jr. Member
  • **
  • Posts: 54
I'm consistently getting a 4 second delay when executing the NewStrings.Assign(FItems); line in procedure TCustomComboBox.InitializeWnd in customcombobox.inc when compiled for 64 bit with LCLWidgetType:=Cocoa.  When compiled for 32 bit with LCLWidgetType:=Carbon it executes this line instantly.

This can easily be reproduced:
- Put a TComboBox on a form
- Add about 500 items to the combo box (I just did this with a for loop in my FormCreate)
- Make sure the Style is csDropDownList (this is the key here - if csDropDown then you don't get the delay)
- Run the program and show the form

Is this something that will maybe be addressed in the next version?

Thank you,
Eric
« Last Edit: July 07, 2019, 08:31:47 pm by emhartner »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11459
  • FPC developer.
Try to wrap it in combobox.beginupdate/endupdate (or combobox.items.*)


emhartner

  • Jr. Member
  • **
  • Posts: 54
The TComboBox does not have BeginUpdate/EndUpdate, so I wrapped as follows but it did not help:

    NewStrings.BeginUpdate;
    NewStrings.Assign(FItems);
    NewStrings.EndUpdate;

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Best to post this over in the Cocoa widgetset board to get noticed.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

emhartner

  • Jr. Member
  • **
  • Posts: 54
I'm consistently getting a 4 second delay when executing the NewStrings.Assign(FItems); line in procedure TCustomComboBox.InitializeWnd in customcombobox.inc when compiled for 64 bit with LCLWidgetType:=Cocoa.  When compiled for 32 bit with LCLWidgetType:=Carbon it executes this line instantly.

This can easily be reproduced:
- Put a TComboBox on a form
- Add about 500 items to the combo box (I just did this with a for loop in my FormCreate)
- Make sure the Style is csDropDownList (this is the key here - if csDropDown then you don't get the delay)
- Run the program and show the form

Is this something that will maybe be addressed in the next version?

Thank you,
Eric

emhartner

  • Jr. Member
  • **
  • Posts: 54

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
I presume you're using the latest Lazarus release 2.0.2.

The issue was fixed in Trunk r60970.
thus if you'd try trunk it should work just fine for you.
« Last Edit: July 08, 2019, 03:55:33 am by skalogryz »

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
To clarify, the Cocoa widgetset has had numerous updates recently, and is actively being improved, largely by skalogryz. It is necessary to use the trunk version to get these fixes though.

For myself, I use the current stable versions of Lazarus for Windows and Linux, but use the trunk version for Mac. Eventually these fixes will end up in the stable release, but not yet. There are lots of folks here to help with questions.
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

emhartner

  • Jr. Member
  • **
  • Posts: 54
Thanks skalogryz and VTWin.  Yes I am indeed using version 2.0.2.  To install Trunk, do I simply follow the instructions here?

https://wiki.freepascal.org/Installing_Lazarus_on_MacOS_X#Download_the_sources_via_svn

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
yes, this should be sufficient

emhartner

  • Jr. Member
  • **
  • Posts: 54
Ok - fpc trunk builds fine, but Lazarus trunk is failing as seen below.  What am I doing wrong?

...
carbonbars.pp(16,2) Error: User defined: only cpu i386 is supported
Compiling carbonprivate.pp
Compiling carbondef.pp
carbondef.pp(187,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[3]: *** [../lcl.ppu] Error 1
make[2]: *** [carbon_all] Error 2
make[1]: *** [interfaces] Error 2
make: *** [lcl] Error 2

Thank you,
Eric
« Last Edit: July 09, 2019, 12:42:28 pm by emhartner »

wittbo

  • Full Member
  • ***
  • Posts: 150
Because i'm developing cross platform, I'm running into this error nearly every time after switching from compiling for Windows back to compiling for Mac. It's the missing check mark for cocoa in the project settings. Since you are compiling a 64bit application (Compiler ppcx64 and platform x86_64) you must check cocoa separately.

-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Ok - fpc trunk builds fine, but Lazarus trunk is failing as seen below.  What am I doing wrong?
try to build Lazarus using this command line:
Code: [Select]
make LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide

emhartner

  • Jr. Member
  • **
  • Posts: 54
try to build Lazarus using this command line:
Code: [Select]
make LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide


I have different errors now:

(3104) Compiling osprinters.pas
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(28,67) Error: (5000) Identifier not found "LCLObjCBoolean"
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(30,39) Error: (5000) Identifier not found "LCLObjCBoolean"
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(28,14) Error: (3058) There is no method in an ancestor class to be overridden: "knowsPageRange(NSRangePtr):<erroneous type>;"
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(30,14) Error: (3058) There is no method in an ancestor class to be overridden: "isFlipped:<erroneous type>;"
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(28,14) Error: (3266) Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
/Users/eric/freepascal/lazarus/components/printers/./cocoa/cocoaprinters_h.inc(28,14) Error: (5070) Mismatch between number of declared parameters and number of colons in message string.
/Users/eric/freepascal/lazarus/components/printers/osprinters.pas(70,1) Fatal: (10026) There were 6 errors compiling module, stopping
Fatal: (1018) Compilation aborted
make[2]: *** [printer4lazarus.ppu] Error 1
make[1]: *** [bigide] Error 2
make: *** [bigidecomponents] Error 2

However, when I issue the following it seems to build fine.  Is this Ok?
make LCL_PLATFORM=cocoa CPU_TARGET=x86_64 clean all

Also, when I launch the IDE and point the to the fpc folder as the source, I get the following warning.  Is this Ok?
Directory: /Users/eric/freepascal/fpc/

Warning: Found version 3.3.1, expected 3.0.4
You can download FPC and the FPC sources from http://sourceforge.net/projects/lazarus/?source=directory

Thank you,
Eric

emhartner

  • Jr. Member
  • **
  • Posts: 54
Just a quick note that the delay I was experiencing before is now resolved when building with the trunk version.  Overall the program runs much faster now (normal speed).

Thanks!

 

TinyPortal © 2005-2018