Lisp HUG Maillist Archive

CAPI: Simulating a button press programmatically

Hi all:

I am implementing an interface for a phycial device that hs physical buttons (similar to https://www.rohde-schwarz.com/us/product/m3srseries4100-productstartpage_63493-9903.html).

For this I am reading physical button presses via system level I/O functions. I do have structures like so:

(defstruct io-event
  event-type
  component-id)

Now I need to translate the event-type :pb-pressed and component-id isomething that mimics a mouse-buton pressed event in CAPI and then "send“ that event somehow into the CAPI machinery. 

Any ideas how this could be done - or where I have to look for design and/or implementation hints? Thank you!

Kind regards

  Frank



_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: CAPI: Simulating a button press programmatically

Hi Frank,

I assume you are describing a system with a dual interface - one in hardware with actual buttons, and a parallel interface on a computer screen with mouse-simulated buttons to perform the same functions.

In that case, when you build up a CAPI Interface to describe your control panel, a CAPI PushButton would invoke some subordinate routine when pressed, carrying along a reference to the Interface and perhaps a data item. You do have some degree of choice in what kind of information is passed along.

Hence, when a physical button is pressed and you get your hardware signal into the program, you would simply call that same subordinate function along with appropriate parameters referring to the software Interface panel. But be sure to call via CAPI:EXECUTE-WITH-INTERFACE so that thread boundaries are respected.

The subordinate routine cannot discern the true source of the call, unless you provide a discriminating parameter. It should function the same way with both mouse button presses and external hardware button presses.

- DM


> On Jun 24, 2017, at 04:51, Frank Gönninger | Gönninger B&T <frank.goenninger@goenninger.net> wrote:
> 
> Hi all:
> 
> I am implementing an interface for a phycial device that hs physical buttons (similar to https://www.rohde-schwarz.com/us/product/m3srseries4100-productstartpage_63493-9903.html).
> 
> For this I am reading physical button presses via system level I/O functions. I do have structures like so:
> 
> (defstruct io-event
>  event-type
>  component-id)
> 
> Now I need to translate the event-type :pb-pressed and component-id isomething that mimics a mouse-buton pressed event in CAPI and then "send“ that event somehow into the CAPI machinery. 
> 
> Any ideas how this could be done - or where I have to look for design and/or implementation hints? Thank you!
> 
> Kind regards
> 
>  Frank
> 
> 
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html
> 


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: CAPI: Simulating a button press programmatically

Hi David,

> Am 24.06.2017 um 14:26 schrieb David McClain <dbm@refined-audiometrics.com>:
> 
> Hi Frank,
> 
> I assume you are describing a system with a dual interface - one in hardware with actual buttons, and a parallel interface on a computer screen with mouse-simulated buttons to perform the same functions.

Exactly - thanks for your prompt reply! 

Reading your answer I realized I was a bit unclear in my post - I also wanted to have a "button pressed“ effect displayed: The buttnn changes its appearance to show a "button movement“ simulation - as is shown here: https://www.youtube.com/watch?v=PrVVo4tQY50

I understand that calling the underlying subordinate function then effects the same function as the button being pressed but that just is then missng the visual feedback.

Thanks again!

Regards

  Frank





_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Re: CAPI: Simulating a button press programmatically

I think that I did something like this 10 years ago (my code is hard to find, in a cardboard box somewhere downstairs).

I think that I created my own button class, maybe sub-classing capi:button and playing with the *-image components of the class.  Sub-classing CAPI classes is a useful trick. 

You might try using the class browser on capi:button to see if anything interesting shows up. You might need to use an unsupported feature which LW folk might leak to you.

Graphically, what you want turns out to be a simple gimmick (so simple that I had a V8-moment (a T.V. commercial in N.A. - slapped my forehead and laughed) when I finally figured it out).  

A grey text button, when unpressed, is a rectangular, grey text area which is slightly smaller than the full button rectangle.

The grey text area sits below and to the right of the button area (touching the right and bottom sides of the button).

There is a light-gray strip on the left hand side and on the top edge.

When the button is pressed in, the text area is moved (translated) to touch the top and left hand sides of the button and a dark grey strip (“shadow”) appears at the right and bottom parts of the button - this gives it the 3D effect of being punched in.

Or, is it that there are strips on all four sides?  Light grey at left and top, dark grey at right and bottom when the button is “out” and v.v. when the button is  “in”?  Watch the video you posted (slowly) and you’ll see what happens.

IIRC, I created “out” and “in” images using Inkscape, then, somehow hooked them to my button class and gave myself control over which image was displayed.

pt

> On Jun 24, 2017, at 11:08 AM, Frank Gönninger | Gönninger B&T <frank.goenninger@goenninger.net> wrote:
> 
> Hi David,
> 
>> Am 24.06.2017 um 14:26 schrieb David McClain <dbm@refined-audiometrics.com>:
>> 
>> Hi Frank,
>> 
>> I assume you are describing a system with a dual interface - one in hardware with actual buttons, and a parallel interface on a computer screen with mouse-simulated buttons to perform the same functions.
> 
> Exactly - thanks for your prompt reply! 
> 
> Reading your answer I realized I was a bit unclear in my post - I also wanted to have a "button pressed“ effect displayed: The buttnn changes its appearance to show a "button movement“ simulation - as is shown here: https://www.youtube.com/watch?v=PrVVo4tQY50
> 
> I understand that calling the underlying subordinate function then effects the same function as the button being pressed but that just is then missng the visual feedback.
> 
> Thanks again!
> 
> Regards
> 
>  Frank
> 
> 
> 
> 
> 
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> lisp-hug@lispworks.com
> http://www.lispworks.com/support/lisp-hug.html


_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html

Updated at: 2020-12-10 08:30 UTC