[comp.sys.next] Overlapping Button Matrices, upper doesn't occlude lower

carlson@lance.tis.llnl.gov (John Carlson) (11/15/89)

I decided to build a small keyboard with Interface Builder
(much like Synthesizer.app).  I decided to use two button matrices,
one matrix for the white keys, and the other for the black keys
(with Transparent, Disabled for B-C and E-F gaps).  I used two
icons for the white keys (pressed and normal) and two for the black.
The prototype button was able to play the System sound I specified, but
neither the Test Mode or compiled version would play the sound (I
tried one sound for all buttons in the matrix).

When testing and in the final version, if I pressed a white key,
The white icon would draw over the black icon.  Does someone
have an easy fix which would keep the black matrix from being
drawn over?

Thanks,

John Carlson
carlson@tis.llnl.gov

stone@rye.cs.unm.edu (Andrew Stone) (11/20/89)

In article <616@ncis.tis.llnl.gov> carlson@lance.tis.llnl.gov (John Carlson) writes:
>
>I decided to build a small keyboard with Interface Builder
>(much like Synthesizer.app).  I decided to use two button matrices,
>one matrix for the white keys, and the other for the black keys
>(with Transparent, Disabled for B-C and E-F gaps).  I used two
>icons for the white keys (pressed and normal) and two for the black.
>The prototype button was able to play the System sound I specified, but
>neither the Test Mode or compiled version would play the sound (I
>tried one sound for all buttons in the matrix).
>
>When testing and in the final version, if I pressed a white key,
>The white icon would draw over the black icon.  Does someone
>have an easy fix which would keep the black matrix from being
>drawn over?
>
>Thanks,
>
>John Carlson
>carlson@tis.llnl.gov

I had a similar problem with CharFind, since the virtual keyboard has
staggered keys. 
The solution: Blit your hiliting on yourself. Have your keys be transparent,
and a subview of KeyBoardView. KeyBoardView is the keyboard's bits without
any key down. When a button gets a mousedown, blit its highlight onto the
keyBoardView,SOVER. On mouseUp, send keyBoardView a display message. You'll
have to subClass matrix to override the mousedown.

andrew

||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||
!!         Andrew Stone             !!       Stone Design Software      !!
!!      stone@hydra.unm.edu         <>      Albuquerque, New Mexico     !!
||<<++>>||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||