[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Touch panel keyboard in GNUstep app

From: Andreas Höschler
Subject: Re: Touch panel keyboard in GNUstep app
Date: Mon, 30 Mar 2020 13:19:09 +0000 (UTC)

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 ...



> Fred
>> Am 25.03.2020 um 18:56 schrieb Andreas Höschler <address@hidden>:
>> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]