I'm looking to detect a touch or release event within a group of buttons and then decode which one was pressed within the SETEVENT routine.
I thought I could do this by defining the buttons within a group and the use GUI.TARGET to narrow it down to one key but now think it's not meant to work this way.
Does this mean I have to set up an event handler routine for each individual button?
Is there a neat way of doing this for a large number of buttons?
The application is a musical keyboard / sequencer which will be feeding a VS1053 MIDI module over serial. The MIDI side works fine.
Code: [Local Link Removed for Guests]
tft.init 1
wlog "Running " + Time$
dim BArr(20)
dim BStr$(20) = ".","A","A'","B","C","C'","D","D'","F","F'","G","G'"
gui.init 30, blue
' Draw buttons on screen and give them group value 20
for bcnt = 1 to 11
BArr(BCnt) = GUI.Button 25 * bcnt,100,20,30,BStr$(bcnt),2,0,0,20,white,black
next bcnt
gui.autorefresh 30,1
' Expect to jump to routine if any of group 20 changes.
gui.setevent 20, CHANGE, keyevent
wait
keyevent:
KeyPressed = GUI.TARGET
wlog "*",KeyPressed
return