How to Change Key Colors in RapidQ

I can't write code. Okay, I can write code, but then after I write it, it doesn't work, and I have trouble debugging it. So my ability to write code is a little like my ability to speak Chinese. I can speak Chinese, but when I do, hardly anybody can understand what I said.

This can be a problem.

How Our TouchScreen Works

When I first got the touchscreen computers, I did not really understand how the screen knew it had been touched. Well, not the screen, but the computer attached to the screen. Here were a few of my initial conjectures:

• light
• heat
• chemical reaction

It turns out it is none of the above in the case of the touchscreen Project Bow has been given. The answer is pressure. You press on the screen, and only by pressing on it can you let it know that you have touched a particular spot.

(This is unfortunate for us at Project Bow, because for our purposes, it would have been better if it had a light sensor. Then we could put the touchscreen behind the zoo glass, and Bow could control it without actually touching it.)

Anyway, the answer is pressure. But how is that pressure measured? Ours is a resistive touchscreen. ItÂ  is made of two flexible sheets and a gap of air between them. When we touch one spot on the screen, contact is made between the two sheets, and this contact is measured in terms of electrical resistance.

But what if we touch two spots on the screen at the same time? We end up selecting a spot somewhere in between.

This design is good for cooperative users who always try to use a product the way it was intended. It is not so good for creative types like Bow, who like to explore every avenue of attack.

Somehow, we need to limit Bow to pressing a single key, so we can prove that his key use is selecting the words he spells.

Recently, I've had two touchscreen computers donated to Project Bow by two separate donors. This is good, because we need to find a way to show the world that Bow is literate. He can write.

In the past, we have been unable to prove this because:

• Bow is faster than we are.
• He spells out words faster than we can see
• If we don't see what he said, then communication does not take place.
• The only reason Bow spells is in order to communicate.
• Bow takes our hands and uses them as pointers, because otherwise we can't see what he says. He doesn't need our hands in order to point. He needs them as a way to direct our attention.
• The scientific community assumes that some sort of cuing from us is taking place, and Bow's communication is not his own.
• To solve this problem, we need a communication device that will allow Bow to spell at his own rate of speed and will sound out what he says so that we can communicate without seeing what he said.

So here we are with two computers that could be potentially harnessed to meet these needs. But in order to use them, we have to understand the limitations and obstacles that stand in our way.

Some of the technical challenges involved in implementing this project are:

• Bow must not be able to take apart the computer, destroy it or damage it -- a physical limitation.
• Bow must not be able to reprogram the computer -- a software problem with physical ramifications. Anyone can reset a computer by pressing all the keys, including control and function keys, in all possible combinations. Human adults don't do this, but chimpanzees are given to trial and error attacks at almost every system. Bow must be denied the rights of a superuser, at least until we can prove he's literate.
• the text-to-speech interpreter must operate in real time, or Bow will be discouraged from using it.
• the keys on the touchscreen should be so configured that Bow cannot access a third key by pressing on two keys at the same time.
• Bow should find the screen and its combination of keys sufficiently engaging to keep his attention.
• The keys must be big enough and far enough apart so that Bow's hand coordination will be sufficient to hit a single key at will.

RapidQ IDE (Integrated Development Environment)

Image Credit: Wikipedia
```Dim saystr as string

Dim SV as QOLEObject
SV.CreateObject("SAPI.SpVoice")

saystr="hello, world"

SV.speak(saystr)
```

The operating system we are using is Windows XP. The programming language is RapidQ. RapidQ is a Basic Interpreter which was developed by William Yu around the year two thousand. He allowed everyone to have it for free.

For some reason, RapidQ executables all work in Windows XP, but those that contain speech-to-text do not work on Vista.

The secret behind RapidQ is that it incorporates the applications that are already in the operating system into itself, so that the RapidQ code doesn't have to do much, except coordinate between already existing bits of code that are available to it.

In the demo program "Hello World" that I was given, for instance, none of the speech-to-text work is actually in the RapidQ program. The program merely sends a string to the SAPI speech application that comes built into the operating system.

I was given a fully operative touch screen speech-to-text executable written by volunteers, together with the RapidQ source code that created it. Because Bow does not know how to use the space bar, my volunteer programmers even included the special feature that the end of the string would be determined based on the length of time that elapses after the last key is pressed. That is, wait too long and whatever you type gets pronounced.

I've been asked not to share the RapidQ code for all that with you, so I will only be discussing the small bit of programming that has been left for me to do. What is it? Change the color of the keys.

That's laughable, right? There should be a property called color, and changing the color of a key should be easy. But for some reason it's not.

The current developer who is actively using RapidQ, someone called Burkley, has written a demo program to show how to make buttons have interesting colors. My mission? To learn how this is done and use this knowledge on the Project Bow text-to-speech touchscreen keyboard.

I'm supposed to read the demo program linked above and figure out from it how to change the colors of the keys in Bow's keyboard. Bow does not seem to want to let me do this, as he creates all sorts of distractions if I try to work on this project. He doesn't seem to mind as much when I write hubs about less abstract subjects, like his own misbehavior. Right now he is sitting in the chair behind me and watching me type. I had to resort to this means of keeping him quiet. Otherwise, he was blowing raspberries and peeing in the potty every fifteen minutes.

From reading the comments, I've gathered that this is a way to pair two button colors, one for when the button that is being selected (by touch or by mouse hovering over the button) and one for when nobody is selecting the button.

Here are some of the questions in my mind as I read this:

• what if two buttons are being selected at once?
• how was the default color set?
• are the numbers for the colors just variables that stand for something else?
• there is reference to bitmaps, but bit maps ought to be binary numbers (usually displayed in hex) , and I don't see anything that looks like that in the code

I suppose the best way to find out is to try to incorporate some of this demo program into something else and see what it does. But Bow is blowing raspberries, and it's almost lunchtime, so I think I'll stop here for now.

I'll let you know if I make any further progress....

More by this Author

• 60

Everybody agrees that prejudice is bad. I have never in my life met anyone who was in favor of prejudice. There is such universal agreement on this topic that it makes us feel united. Except when it comes to actual...

• 57

This week, my daughter was assigned a rainforest diorama to make. Her grade on this assignment counts as a science test. This is a little odd, I think, as the skills necessary to make an effective diorama fall mostly...

• 21

Suppose you go into your YouTube account and start browsing and suddenly all the labels are in a different language -- a language you can't read. How do you change it back? Easy. You find the label that says...

nhkatz 7 years ago from Bloomington, Indiana

Aya,

A small correction: RapidQ executables do run on Windows Vista. The thing which doesn't work so well is accessing the text to speech.

Both Windows XP and Windows Vista come with built in text-to-speech which should be accessible through SAPI (the speech advanced programming interface.) The idea behind an API is that the programmer can access some part of the hardware without knowing anything about how the hardware really works.

Despite the fact that in 2000 when RapidQ was written, no version of Windows supported text to speech, and William Yu presumably had no way of knowing that any version ever would, there were plenty of API's for other purposes around. So RapidQ contains a variable type QOLEOBJECT which allows one to interact with API's. The code that you're using accesses text-to-speech in XP simply by defining a QOLEOBJECT to be SAPI.

For some reason the same thing doesn't work in Vista. I'm not sure why. I presume it is because of changes made by Microsoft to the way API's work between XP and Vista.

There may be a workaround if you really need the code to run on Vista.

Nets

p.s. Rumor has it that Microsoft's new operating system Windows 7 will come with a Windows XP emulator. I don't know if this emulator can be trusted, but a good test for it might be to see whether the RapidQ code runs under it.

nhkatz 7 years ago from Bloomington, Indiana

Two buttons cannot be pressed simultaneously as long as the buttons are nonoverlapping. The definition of the event that a button is pressed is that the mouse is clicked while the mouse pointer is in the region of the button.

An interesting question is what would happen if you insisted on programming two button to overlap. I have never tried this (and it might be fun.) Either you would get a compiler error (which is what should happen) or RapidQ will choose in some way which button to pay attention to first. (The way buttons work is that for each button there is a subroutine called when the button is pressed. You can't call two subroutines in parallel in RapidQ.)

In Burkley's code there is an array of 12 .bmp files. They are BtnBMP(j) where j ranges from 0 to 11. There are six buttons. Two of the files correspond to each of the six buttons. One has the "default" color and the other has the changed color.

The files are defined in the subroutine MainForm_OnShow. While you are correct that BMP's like all files are binary sequences, as with other files, we might want to manipulate BMP's in a higher level way. In RapidQ, a .BMP file is a kind of object and it is being written in the subroutine MainForm_OnShow using the object's .paint method. Hence you have expressions like

BTNBMP(j).Paint ( ... )

in that subroutine.

I didn't understand the question about "numbers for colors", so I won't try to answer it.

Nets

Aya Katz 7 years ago from The Ozarks Author

Nets, thanks for the quick response time. I'll correct the statement about executables not running in Vista to speech-to-text executables not running in Vista.

I don't really need to have it run in Vista. It's just that the computer I use most frequently in the pens has the Vista operating system. This won't prevent me from writing code, just checking if it works.

Thanks also for answering the questions.You covered all of them in fact, even the one about the numbers for the colors.

I will have to look more carefully into MainForm_OnShow.

Jerilee Wei 7 years ago from United States

At first glance, I wasn't sure I could grasp what you were trying to accomplish, but that proved not so. What I found fascinating about this hub though, is that it proves what a great community we have here -- where you can be entertained, taught, teach, inspire -- and where others here, can help give you the answers you are seeking, or point you in the right direction. At the same time, it gives much food for thought for some readers. That's pretty awesome!

Aya Katz 7 years ago from The Ozarks Author

Thanks, Jerilee! I've found that sometimes a hub is a good way to organize my thoughts on a topic and to find out what I understand and what it is that have yet to learn. And the fact that there are helpful people willing to give answers and to cheer us on our way is definitely a benefit of being part of this community!

Paper Moon 7 years ago from In the clouds

Aya Katz 7 years ago from The Ozarks Author

Paper Moon, thanks for your support!

June Sun 7 years ago from Alberta, Canada

I haven't read all the hubs so not sure whether you are making different progress on Q-rapid. I am always interested in 'finding out' how to use (not about writing codes) a software on my own without reading any user's manual (because I am impatient), but I guess for Q-rapid, it's not just error and trial. I also have trying to learn writing codes with some programs, but it's really tedious job for me. Hope I will have time to do it in this coming semester. :)

Aya Katz 7 years ago from The Ozarks Author

June, thanks for dropping by. I am still learning RapidQ -- slowly. I was happy to hear that you recently mastered Praat and I hope to get some pointers from you on that. In fact, could you write a Hub about how to use Praat? It would be a big help! I especially want to know how to embed a Praat window in a document.

June Sun 7 years ago from Alberta, Canada

Actually I am still learning Praat. I didn't say I mastered it. :) I have to use it for my project anyway. So eventually, I guess I just have to master Praat, and some more. Let's learn together. It's a lot of fun.