Sometimes I can only realize: what the heck they are crazy. A customer asked me cause of his Desktop App in Xojo that there are NO colored buttons available. I found solutions with declares and many other solutions which are not realized on base of buttons. Is this language really as crazy as I think? Can’t the programmers color the buttons like they want to? I saw much things in my life but: here it ends up. Neither in C# or Java I had such a problem in my entire life as programmer. This people are really on a perfect way to cut off the last pro customers. I had to explain to the customer that there is no cross platform solution for his problem available. There are solutions with declares. But. They are platform dependent. With an app with hundrets of buttons? Na. He thinks now about rewriting. He closed his last door to xojo. Now Java with JDeploy. Simple, cross platform and without any problem. But what does this mean? Simply it means that Xojo is half baken. Simply half. I can’t believe that this System is so low level that you have to break your arms to have a colored button. I can’t believe.
well I’ve recently read an essay “C is not a low level language” with the definiton of “low level” given by computer science pioneer Alan Perlis:
A programming language is low level when its programs require attention to the irrelevant.
Guess on what I thought when I reflected my hacks in Xojo during the last decades.
Well, to be fair, they are very Mac-centric and AFAIK native MacOS buttons don’t have colors by default. But it’s getting more irrelevant every year as web apps and web foundations are used every day on desktop computers.
Subclass once
Implement declares in that subclass
Use the subclass
But yes in general they dont expose many capabilities
NSButtonCell.Background color ought to do it
Fuck the subclass. It’s totally stupid. End of discussion. Made me laughing. Use subclass sounds like break your bones. Simple, isn’t it? Macos isn’t the main target of the most, windows is and that’s the measuring point. It is ridiculous. Painful. That’s not possible. Use subclass. For inemof the most simple things. Use subclass. Exactly that what is needed. In swift ui it is no problem to do, wasn’t it .tint? I have to look.
Perhaps there are more developers using Windows (i’m not one of them), Perhaps there are more using Java than Swift (again, I am not one of them). But your constant, “you don’t do things like I do, therefore you are stupid” , is insulting to (gonna go out of a limb here) but to almost everyone on this forum.
The entire point is: I am exactly not saying that. It is insaulting, that Xojo provides not even the lowest level functionalities. People may not need in while not used to it or while they are not developing UI interfaces with colored buttons. But the ability to should be there. Has nothign to do with the developers. If you use it or not: has nothing to do with the ability to do it. And like I said: even with SwiftUI you can do that.
Oh I agree no user should have to do this for themselves
There should be an easier way
But it IS possible
It definitely should be possible in a much more straightforward way
Esp to the users that Xojo targets
But I dont work there any more
And even when I did I could not convince the powers that be that this sort of stuff was useful to the user base they chose to go after
That’s the point I don’t understand. They are not looking to the people they want to have as customers. Or, another way: they have no Idea about that. It is a simple feature. I would say one which is available in nearly all UI frameworks I know. Even in Swift UI. But not with Xojo. Declares are platform dependent. Yes, you could filter out which OS and then…but hey, is that really the right way to handle this stuffs. We have this in iOS, Web and Android too. I know: it is no problem to find a workaround. But on the other side: for such small and simple operations is a workaround needed. For nearly everything what is not really simple: a workaround is needed. That is not the best Idea they ever had. Let me say it so.
this is deprecated
(button.cell as? NSButtonCell)?.backgroundColor = .red
a simple background color
button.wantsLayer = true
button.layer?.backgroundColor = NSColor.red.cgColor
or a full subclass and override the “draw function”
but unless you wan to add specific code to each NSButton instance, you end up creating some level of a subclass (which is one of the basic tenet of OOP)
What can I say
They say one thing about who their audience is
Then they say it’s professional users. And beginners. And citizen programmers.
And everyone ! And no one !
And dogs & cats and …
And then they do stuff that alienates a bunch of those
They dont have a consistent marketing message
Nor do their actions match up with their marketing
Its chaotic since the message & the actions arent, IMO, consistent
And its long been that way
And it frustrates people like crazy
No idea
I just looked up NS button in Apples docs and got
says nothing about it being deprecated that I can quickly see
NSButtonCell itself was formally deprecated in macOS 10.15 (Catalina).
Not NSButton
only shows a handful of methods / properties on it as deprecated
Not that I;m just quoting Apples docs so it aint my fault if that isnt correct
yeah, seems Apple deprecated this, but failed to properly document it. Never used NSButtonCell myself, but articles indicate that many of the API functions that are in the docs, no longer are operational
NSButtonCell was one way a person could define their own button types
Create a subclass of it and set the cell renderer to your new custom one & off you went
But it does seem Apple is finally removing a decent amount of complexity they inherited from NeXTStep where this design pattern was common
Sounds a bit familiar to me. But by the way: macOS has this feature and can provide colored buttons. While it is not real XPlat but for all apple platforms there is no problem as long as you stay in apple’s world. What you do.
In case of my Customer it is a bit more complex. Linux, Windows, macOS for Desktop are in use. More and more Linux while it is not right to throw good hardware away while it get’s no updates anymore. So we decided to switch to Linux with this older apple devices (most are MacBook).
I used in history many times colored buttons. Machine starts, pausing, stopping (green, blue, red) for example. Or other System controlling stuffs where I need to color up the UI. If I want to or not.
As all of this has to be cross platform it becomes more complex. And there are many other insaulting workarounds needed in this Software.
I can’t believe you can’t believe it.
Makes me want to reply with
It’s not butter !?!?!?!?!?
But yes
For certain uses colors helps convey extra information
But they should be relied on for the ONLY way to convey that extra information since people do suffer from color blindness
Men more so than women
And that can be a problem
I Ski Patrol with a fellow who is red green color blind so things that only have RED as a warning color arent particularly effective for him or anyone like him
I know that some developers are plugin-averse, but Einhugur has a CustomButtom control that can handle the color thing cross-platform, without resorting to declares. What I happen to like most, though, is that it also allows dynamic resizing of the button for localized text in the caption (in conjunction with Björn’s FlowLayout.)