Author Topic: Cocoa widget set does not seem to work at all  (Read 6004 times)

allanm

  • New member
  • *
  • Posts: 8
Cocoa widget set does not seem to work at all
« on: April 28, 2013, 12:40:04 pm »
I wanted to try out the Cocoa Widget set, so I set the LCLWidgetType to cocoa.
Compile a blank form and everything works ok.
Try it again with a single button on the form. Compiles OK, form with button is displayed. But app closes after a few seconds with 'quit unexpectedly error'.
Happens on both OS X 10.6.8 and 10.7.5. Am using Lazarus 1.0.8.

I know that the Cocoa Widget set is incomplete, but I can't seem to get anything other than a blank form to work.

Am I missing a step? Or is the whole thing (LCL Cocoa) just really unusable/unstable?
From what I read I thought that it was working, but just incomplete.




Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Cocoa widget set does not seem to work at all
« Reply #1 on: April 28, 2013, 04:15:23 pm »
Cocoa widgetset is still alpha quality AFAIR, things can go wrong between revisions quite easily especially if you use stable version. Even TForm is partially implemented. You can ask the author directly as he's quite active in the forum.

allanm

  • New member
  • *
  • Posts: 8
Re: Cocoa widget set does not seem to work at all
« Reply #2 on: April 28, 2013, 10:30:52 pm »
Ok thanks. So I guess you are saying that an older version of Lazarus would probably actually work with the Cocoa widget-set (as far as that it has been implemented)?

Does anyone know which revision I should use if I just want to compile a basic (but stable) program containing basic forms and buttons etc using the Cocoa widget-set?


Leledumbo

  • Hero Member
  • *****
  • Posts: 8836
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Cocoa widget set does not seem to work at all
« Reply #3 on: April 29, 2013, 03:15:22 pm »
Quote
So I guess you are saying that an older version of Lazarus would probably actually work with the Cocoa widget-set (as far as that it has been implemented)?
No, I said that would be worse than trunk. Current trunk is the best state, perhaps.

allanm

  • New member
  • *
  • Posts: 8
Re: Cocoa widget set does not seem to work at all
« Reply #4 on: April 29, 2013, 10:10:23 pm »
Oh Ok.

Actually found that TButton is working if it is not set as the default button. If there is a default button (ie blue pulsating) on the form, then the whole app crashes.

Also get crash with TComboBox and TEdit if they are simply present on the form. These are classified as 'working' on the roadmap (http://wiki.lazarus.freepascal.org/Roadmap) so was expecting them to at least not cause a catastrophic crash.

I would be very interested in getting the above three controls working for an app that I have. If anyone can help.

Cheers,
Allan


jwdietrich

  • Hero Member
  • *****
  • Posts: 1278
    • formatio reticularis
Re: Cocoa widget set does not seem to work at all
« Reply #5 on: April 29, 2013, 10:13:53 pm »
Your observations may be valuable for the developer. Please report them via the bug tracker.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

allanm

  • New member
  • *
  • Posts: 8
Re: Cocoa widget set does not seem to work at all
« Reply #6 on: April 30, 2013, 12:42:17 pm »
Will do, but still making observations:

Form with pulsating button actually only crashes if you move the mouse.
In CocoaWSCommon, i found that if you add an 'exit' the function:

function TLCLCommonCallback.MouseMove(Event: NSEvent): Boolean;
var
  Msg: TLMMouseMove;
  MousePos: NSPoint;
begin
  Result := False; // allow cocoa to handle message
         Exit;  //EXIT HERE
....
             
Then the form doesn't crash immediately when moving the mouse (though still seems to crash eventually after few minutes).

So I guess there is something wrong with the Event handling??


allanm

  • New member
  • *
  • Posts: 8
Re: Cocoa widget set does not seem to work at all
« Reply #7 on: May 03, 2013, 01:18:24 am »
Forget what I said in the previous thread. This seems to fix the problem:

In CocoaWSStdCtrls, add this line to the end of the function TCocoaWSButton.setDefault:
NSButton(AButton.handle).superview.setWantsLayer(true);

The default button now pulsates and does not crash the form. I am new to Cocoa so I don't really know why this works.

I will look at the TEdit control now. It's presence seems to instantly crash a form also.

 

TinyPortal © 2005-2018