At this point in development, my program is working well. I have a button, “btnStartRecord” - when clicked then the Action event fires and all works as it should.
I’ve decided that instead of just the button being clicked, I’d like to include that the “record sequence” be started if the spacebar is pressed.
There are three problems that I’m dealing with at the moment.
1. My code is incorrect 2. And/or placement of the code is incorrect. 3. The error thrown up is complete nonsense 4. Too many beers
1) This is the code I’ve used to capture the KeyDown event:
if Asc (32) then
// Record sequence goes here
MsgBox ("You pressed the space bar") // for testing only
end if
This code is lame and obviously the wrong syntax, I can deal with that and work it out later. Unfortunately to make it all worse b[/b], there’s the rather obscure error “There is more than one item with this name and it’s not clear to which this refers” is offered. This is no help whatsoever.
2) I have the KeyDown event under the button control along with the action, so I’m guessing that the KeyDown event will only ever happen when the button is pressed? - not good.
I think that the KeyDown event needs to be captured somewhere in the outer loop. If so, can you CALL “btnStartRecord” as if it was pressed? (this worked in VB). This would make it easier than repeating code. Aplologies if this doesn’t make sense - perhaps a result of point b[/b]
Anyway, many things to learn - I’m really enjoying programming with Xojo, the best programming language and IDE that I’ve ever used. I love Xojo very much. . . Ummm . . . perhaps point 4 is taking too much control.
The button’s KeyDown event will fire when the button has focus. On Windows, buttons are part of the tab order by default. On Mac, they are not; you have to enable that on each machine. Also, if the button has focus, the default action for space bar is to fire the button, so you don’t need special code in KeyDown.
Instead of trying to catch keydown in the button, it would be easier to check Keyboard.AsyncKeydown(31) in a timer. It will detect space no matter which control has the focus.
Thanks for pointing that out Michel. Not an issue for me at this point, although I do have some interest in the different approach for MacOS. Also for others reading this post, an explanation of the differences may be worthwhile.
I’m just a ‘hobby’ programmer, not professional. When I get to the point that I feel my software will work, then I’ll buy the license for Windows. I can therefore share it with a few friends that have similar interests. Possibly even sell it to a wider (yet limited) group and also finish off/re-invent some other old projects. Who knows.
I’m really liking Xojo - it’s the programming solution that I’ve always been looking for
I too started as a hobby, a long time ago. And when I started, there was little option other than teaching oneself, anyway.
Don’t hesitate to explore the Mac App Store as a distribution vector. It is way simpler than anything else.
What I meant above is that if the use (customer) has to activate full keyboard access, it can be a problem. The simpler for the user it is, the less support requests you get.
That is the reason why I suggested another approach.
Thanks for that info Michel. My software is specialised and not something that would be appropriate for the Mac App store because it’s very boring.
It’s a basic Data Logger. It will run on a laptop (or perhaps tablet?) used in field testing. The computer will be tethered via usb to this device for recording the impulse of model rocket motors . . . . um . . . can’t see where to attach an image.
I can only review the image if I select your link. I’ll check it out tomorrow.
The prototype impulse/thrust meter has taken the last 6 months to build, which is a culmination of 30+yrs of experience making other lesser models and programming solutions. The electronics consists of an Arduino Uno development board which took a bit of work to program in itself.
Now that part is working, and the physical structure is complete, I’m working on the interface.
The Software will accompany the device, as in a “stand alone” unit. But hopefully, with careful programming, will also be able to import data from other devices, directly, or from data files - and above all be simple to use.
I started writing software for the device in June last year. I downloaded visual studio, tried C#, Visual basic etc. and found it all too overwhelming and frustrating. It was by pure happenstance that my brother told me about a serial port recording program written by Roger Meier (who has been mentioned on this forum).
I checked it out and was impressed. Roger indicated that the software was written using Xojo, and that’s why and where I’m at.