StrataFrame Forum

Any way to control format of combox when enabling/disabling?

http://forum.strataframe.net/Topic12232.aspx

By Greg McGuffey - 10/26/2007

I'm trying to control the enabled/disabled state of a combobox, based on editing state. I know how/where to handle this (EditingStateChanged event), but when I disable my combo, it has a gray background. I tried to instead use the BindingEditable property, but it did the same thing. Yet, bound SF combos have a white background and light light gray text. What am I not doing/doing wrong?



Thanks!
By StrataFrame Team - 10/30/2007

Are you using an SF combo box or a regular combo box?  We override the OnPaint() of the SF combo box to draw the different colored background because people hate the way you cannot read disabled text.  So, if you're using the SF combo box, it should be doing that when you use the Enabled property, but if you're using the regular combo box, then it won't have that functionality.
By Greg McGuffey - 10/30/2007

I'm using a SF combo. When it is bound it has light light gray text on a white background. But when it isn't bound, it is black text on a gray background.



On a side note, how do you control that enabled appearance? I haven't noticed any difference in its behavior.
By StrataFrame Team - 10/31/2007

I'm going to have to defer to Trent on this one... I'll have him check it and let you know.
By Trent L. Taylor - 10/31/2007

If the control is not bound then we do not manage the enabled states.  When bound, however, we manage the state of a combo box differently than any other control.  The reason for this is that when a combo is a DropDown it renders differently in a disabled state then when a DropDownList.  Thus, when disabled, the control will always render as a DropDownList and we manage the state back and forth.
By Greg McGuffey - 10/31/2007

This seems to support that it will be hard to get an unbound SF combo to look the same as a bound SF combo.



My solution was to add a custom bindable field to the BO that just translates the value of the field to the enum I want. I.e. I had a boolean field, but wanted to provide a drop down with yes/no in it. I just made a custom field that translated the boolean to the enum on get and from the enum to boolean on set. It works great.



Thanks for the clarification on how this works.



One last question: you've stated that you did work to render the disabled controls in a more readable state. Is that done? Do we have that? All my disabled controls are still light light gray on white when disabled.
By StrataFrame Team - 11/1/2007

Yes, they are normally dark gray on light gray when disabled and they have been changed to gray on white (it actually is more readable...).  But there should be new properties on the controls for background/foreground disabled colors, so you should be able to changes those and get the effect you're looking for.