Hi Andreas,
in NSButton you find this code:
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
{
return YES;
}
You will need to write a subclass to handle this different.
Cheers,
Fred
> Am 25.03.2020 um 18:56 schrieb Andreas Höschler <[email protected]>:
>
> Hi all,
>
> I am just trying to add a touch panel keyboard feature to some GNUstep app,
> meaning that I have added a bunch of NSButtons with titles "A", "B", "C",...
> to the GUI of my app. My plan is to generate and send some key-event whenever
> a user clicks (actually presses with his finger on a touch screen) on one of
> the on-screen keyboard buttons.
>
> However, for this to work I need to make sure that the keyboard buttons never
> get first responder but that e.g. an NSTextField in the GUI (first responder
> before clicking on a key button) stays first responder and receives the
> programmatically generated key-event.
>
> I have run
>
> [button setRefusesFirstResponder:YES];
>
> on the keyboard buttons but this did not do the trick. The NSTextField that
> is first responder before clicking on one of the key board buttons resigns
> first responder before the action of the button is executed. :-(
>
> Any idea how to correctly set this up?
>
> Thanks a lot in advance!!
>
> Best,
>
> Andreas
>
>