[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Touch panel keyboard in GNUstep app
From: |
Wolfgang Lux |
Subject: |
Re: Touch panel keyboard in GNUstep app |
Date: |
Mon, 30 Mar 2020 17:02:47 +0200 |
> Am 30.03.2020 um 15:19 schrieb Andreas Höschler <ahoesch@smartsoft.de>:
>
> Hi Fred,
>
>> in NSButton you find this code:
>>
>>
>> - (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
>> {
>> return YES;
>> }
>>
>>
>> You will need to write a subclass to handle this different.
>
> Thanks a lot for your response. I created a subclass KbButton and overwrote
> this method like so
>
> - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
> {
> NSLog(@"%@ returns acceptsFirstMouse NO", self);
> return NO;
> }
>
> When I click on the button the currently active NSTextField looses first
> responder and the action of the button is called
>
> 30/03/20 14:42:16,912 ScaleMaster[59798]: strike sender <KbButton:
> 0x7b82ae50> stringValue A
>
> The method acceptsFirstMouse: of KbButton is never called. So this
> unfortunately does not work, at least not on MacOSX (dev machine for the
> project). :-( I will port the code to GNUstep and see whether GNUstep behaves
> differently. Will let you know ...
Well, yes. I'm afraid Fred's advice is wrong (even though . While the code in
-[NSWindow sendEvent:] indeed requires The method acceptsFirstMouse is
supposed to serve a different purpose. When you activate window by clicking
onto it, acceptsFirstMouse governs whether this click is passed to the control
under the mouse (acceptsFirstMouse returns YES) or whether it is only for
activating the window (acceptsFirstMouse returns NO). Your original approach
calling setAcceptsFirstResponder: with NO looks right to me. It is just that
the code in -[NSEvent sendEvent:] gets the logic wrong. Where it currently says
if ([v acceptsFirstResponder] && ![self makeFirstResponder: v])
{
return;
}
it should really say
if (![v acceptsFirstResponder] || ![self makeFirstResponder: v])
{
return;
}
- Failed to get spell checker, Riccardo Mottola, 2020/03/17
- Re: Failed to get spell checker, Wolfgang Lux, 2020/03/18
- Touch panel keyboard in GNUstep app, Andreas Höschler, 2020/03/25
- Re: Touch panel keyboard in GNUstep app, Fred Kiefer, 2020/03/25
- Re: Touch panel keyboard in GNUstep app, Andreas Höschler, 2020/03/30
- Re: Touch panel keyboard in GNUstep app,
Wolfgang Lux <=
- Re: Touch panel keyboard in GNUstep app, Wolfgang Lux, 2020/03/30
- Re: Touch panel keyboard in GNUstep app, Andreas Höschler, 2020/03/30
- Re: Touch panel keyboard in GNUstep app, Fred Kiefer, 2020/03/30
- Re: Touch panel keyboard in GNUstep app, Andreas Höschler, 2020/03/30
- Re: Touch panel keyboard in GNUstep app, Andreas Höschler, 2020/03/31
- Re: Touch panel keyboard in GNUstep app, Matt Rice, 2020/03/31
- Re: Touch panel keyboard in GNUstep app, Fred Kiefer, 2020/03/31