Programmatically I enable and disabled iOSButtons. When I call iOSButton.Enabled = false the button is indeed disabled, but the color does not change to the normal “greyed out” color. Disabling the iOSButton in the IDE does “grey out” the button.
I’d still expect the button to change color though, right. In the IDE the color changes when we change the “Enabled” value to false, it just doesn’t do this when we programmatically change the “Enabled” value to false.
I don’t need to access any of the other properties to be honest. I just want it to visually appear disabled when disabled.
The simulator & device are THE standard to compare the IDE to.
If it doesn’t disable in the sim or on an actual device thats “correct”.
That the IDE draws it disabled is the IDE not mimicking the actual iOS behaviour correctly.
When you design a layout for the desktop we get the OS to draw the controls - so they appear correct as it IS the OS drawing them.
For the Web & iOS we cant do that - so we have code in the IDE that mimics the appearance.
And its pretty darned close - but there may be differences - and differences are 99.9% assured to be we’re mimicking things incorrectly.
In short the bug here would be the IDE showing it in grey as “disabled” since that is not correct.
Huh? I think the IDE is “correct” and the compiled code is NOT “correct”
even if you don’t expose the all the attributes of a UIBUTTON, standard behaviour is disabled controls are indicated to the user as being disabled, which is clearly NOT the case here…
Create a simple Xcode project
put in the view 2 buttons
set the “action” for the first button so that enable and disable the other button (i.e.: _btn.enabled=!_btn.enabled)
Run the project
Click on the button the second will become gray (disabled)
Click again the button will return standard.
That’s to say that on iOS disabled button are gray (if don’t set any feature so that it change to another color)
Norman is right: the IDE is just a representation of what needs to happen, but in this case the IDE is correct.
There is a UIControlState 'UIControlStateDisabled ’ for a UIButton.
Perhaps XOJO is missing [button setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled]; when disabling a button programmatically?
Also, for consideration: http://stackoverflow.com/questions/5715092/disabled-uibutton-not-faded-or-grey
UIButton doesn’t have a disabled look.[/quote]
Of course I read his response… and my opinion is the operation is WRONG… a disabled control should be grayed out.
And that Stackover flow has not bearing on the subject. A UIButton CAN be disabled, and the visual attribute CAN be gray (or any other color for that matter)… I do it all the time (just not in XOJO… but then the Stackover flow was not referring to XOJO either)
Here is how SWIFT does it… and all this proves is that the attributes ARE there and they DO work…
this would have BLACK text at idle, BLUE text when selected and GRAY text when disabled… not rocket science
and I left out the examples of adding borders, shadows, background colors etc… Basically an iOS UIButton can have all (more) attributes than an XOJO DESKTOP button can have.
iOS itself does not automatically change color when disabling a button.
If you want to do what Dave mentioned above right now and change it, you can look at the included UIButtonDeclares example that comes with Xojo- and copy the UIButton class to your own project if you want to use it there.
[quote=245586:@Travis Hill]iOS itself does not automatically change color when disabling a button.
If you want to do what Dave mentioned above right now and change it, you can look at the included UIButtonDeclares example that comes with Xojo- and copy the UIButton class to your own project if you want to use it there.[/quote]
That’s getting into the distinction between what either language support framework does and what iOS itself does. That doesn’t help David change the color on his buttons in Xojo either way.
The bottom line is if anyone else reading this wants the color changing behavior described today in Xojo, they can just copy the UIButton class from the included UIButtonDeclares example and be on their way. Whether or not the Xojo framework should default to that behavior on top of iOS is certainly worthy of consideration too (I actually don’t disagree myself)- I’m just trying to help David get the result he wanted from Xojo right now.