Cocoa widget set does not seem to work at all lazarus / 15-macOS - Mac OS X ---------------------------------------------------------------------- allanm · 2013-04-28 10:40 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 · 2013-04-28 14:15 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 · 2013-04-28 20:30 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 · 2013-04-29 13:15 QuoteSo 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 · 2013-04-29 20:10 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 · 2013-04-29 20:13 Your observations may be valuable for the developer. Please report them via the bug tracker. ---------------------------------------------------------------------- allanm · 2013-04-30 10:42 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 · 2013-05-02 23:18 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.