This will probably only be of interest to those zscripters who tinker with code for pleasure and can stand a degree of hair loss but I thought I would share my recent experiments into Note interfaces.
Note interfaces are very useful because you can pretty much design an interface how you want. The major drawback is that you’re limited with what type of widgets you can use - buttons or switches, and that’s it.
For a Note interface to work, the Note that displays the buttons has its duration set to 0 which is the equivalent of ‘wait for user action’. When the Note is wrapped in a loop, the interface can be made to update after a button press rather than exit, and so more complex functionality is possible. Unfortunately, the button press is necessary - the interface won’t update without it.
However, if the Note duration is changed - the optimum value appears to be 0.001 - then the interface will update without any button presses. This is all very exciting until you discover that the buttons don’t work any more. So some way has to be found to either get back to the 0 duration, or to capture the button presses in some other way.
This is my attempt. There are two variations here:
-
The Slider interface sets the duration to 0.001 when you click on the slider. The interface will then update as you drag the mouse, so the slider value changes and the color swatch varies in color. The drawback here is that the slider doesn’t work exactly as a normal slider: you click to start and click to stop (or move off the slider) but you don’t drag - when active the slider simply follows the mouse. The advantage of this implementation is that any noteibuttons work as normal.
-
The MouseOver button interface has the duration set to 0.001 from the start. This means that mousing over the picture will change it. Clicking on the picture will exit the interface. If you mouse over the orange bar it will be picked up by the mouse and dragged around. Clicking it will return it to its starting position. The button actions here are got by using the mouse state, which registers while a note is displayed, so the buttons used are all disabled as the duration is never at 0 and they don’t work.
I find both these methods reliable enough to be useful but they may not be so for others, so please post your impressions if you’re interested. The code and button images are in the zip. If you come up with alternatives or improvements please post them in this thread.
[Edit: Well, I’ve just discovered that having the left tray open throws things out, so that will need solving.]
[Edit2: Doh! Typo in the code, IHPos when it should be IVPos… code adjusted]
Enjoy,