I will try it in a few hours 

-----

Please excuse the shortness of this mail which was sent from my mobile phone. 
If necessary, I will send more information later.

Cheers,
Tobias Giesen

> Am 11.06.2019 um 16:19 schrieb Dmitry Boyarintsev via lazarus 
> <[email protected]>:
> 
>> On Tue, Jun 11, 2019 at 10:06 AM David Jenkins via lazarus 
>> <[email protected]> wrote:
> 
>> I looked at the assembly for NSApplication.run, there are a lot of things 
>> being called and set before the call to nextEventMatching...   The 
>> .isRunning variable being one of them - which is read only and can't be set. 
>>  It can be overridden (and is one of the suggested overrides) but 
>> unfortunately there are times, in other parts of the code, that they look 
>> directly at the ._running variable where the value of .isRunning is stored 
>> instead of calling .isRunning (look at NSApplication._setMainWindow).  Which 
>> sets up a mismatch between what an overridden .isRunning method would return 
>> and what ._running is set to.
> 
> Let's back-up a little bit.
> 
> Can we actually try to set the value for the instance variable?
> 1) it's absolutely legal in Objective-C terms (object_getInstanceVariable, 
> object_setInstanceVariable).
> 2) its' absolutely legal in KVC term. (I can presume that KVC is pretty much 
> based on top of objc-run time. And this is how the entire Swift<->ObjC 
> binding works)
> 
> Can anyone try and modify TCocoaApplication.run to look like this. (If you're 
> using trunk, you'll need to have {$define COCOALOOPOVERRIDE} defines in 
> cocoadefines.inc}
> 
> procedure TCocoaApplication.run;
> begin
>   self.setValue_forKey(NSNumber.numberWithBool(true),NSSTR('_running')); // 
> setting instance variable through KVC
>   isrun:=true;
>   aloop();
> end;  
> -- 
> _______________________________________________
> lazarus mailing list
> [email protected]
> https://lists.lazarus-ide.org/listinfo/lazarus
-- 
_______________________________________________
lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to