I have searched for a way to have colored desktop buttons; apparently the Mac software dos not allow this. I found a simple system that gives me what I want. Some users have said to create your own PB with a rectangle, then use the various commands to make it work. That would work, I’m sure. But it removes all the attributes embedded in the language for the DesktopButton, so I searched for a better way (for me) - on the Mac.
I create rectangles with rounded corners - in my case the buttons are 80 px wide and 20 px high, so I made a rectangle with a width of 80 px and height to 22 px with an 0.5 px border, made it transparent and placed it over the existing PB, and ordered it to the back and made it transparent.
It appears to work as you can see - it doesn’t interfere with the DesktopButton actions, and improves the recognition of the buttons for use.
Can’t defend the uppercase/lowercase issue - but your point is well raised - I will revisit that.
As to the “QUIT” button this screen is the opening screen of my program after password entry. (For the record it is a personal program for my own use). I can still “back out” without changing any files. Any farther into the program and the user must exit the program only after visiting the Backup screen to make sure files are written to disk and backed up to an external source.
Again - those of you who write commercial software have different motivation. I want these things as reminders that a step has been missed - or not yet invoked - so data is not corrupted.
Jean-Yves: My desire to have the DesktopButton features is mostly centered around the “Default” option letting me page through screens with the Return button. I’m sure some of the more advanced programmers could capture that KeyDown event and make it work like the Default option of a PB, but that isn’t easily concocted for me.
don’t be afraid to make it work !
you have almost all you need in your sentence to make it work like you want …
make a small project with the start of it, the canvas subclass, draw what you want
then come back here upload the project and we will be happy to add the keydown event for you
Here’s an old example project that demonstrates how to subclass a DesktopCanvas and implement the KeyDown + KeyUp to raise an Event Definition “ButtonPressed”.
It also handles tabbing and focus ring, and capture the space bar when the canvas/button has focus to activate the pressed event.
Of course, to make this example look like your own button design, change the code in the Paint event.
On some cases, there is no need to go thru some windows to test a new feature and I add a button on the first window to call that feature.
With a bad vision, sometimes I search where that button is on the front window. I will add a Red background button named [DEBUG]. I am sure I will never search it then.
Greg - that is a great solution. I put your code into the program then found in the Library I now had a “Colored Desktop Button”.
I put some silly code within the button placed on one of the windows, and it certainly works as you mentioned. I was able to change the caption and color “on the fly” by pressing the button; this opens up a whole host of opportunities for my little program.
Many thanks for this innovative solution - maybe Xojo will add this to their bag of tricks in the IDE.