?
Solved

Best way to disable combobox?

Posted on 2009-02-17
8
Medium Priority
?
4,340 Views
Last Modified: 2012-05-06
I am trying to globally enable/disable form fields based on a boolean var I am setting dynamically per record.

This code is not working for my comboBox, I am still able to change the values even though I editMode = false.

Neither one of these fields should be editable because the editMode = false (both in default and in the value I am passing in), but I activate the date picker & drop down menu.

What am I doing wrong?

I have tried enabled=, but it makes the whole combobox background a darkgrey color, and I don't want to color to change, just unclickable.

If I must use enabled for both combobox and datepicker, how do I change the background color to it? There doesn't seem to be an attribute I can find for that.



[Bindable] public var editMode = false;
..
..
..
<mx:FormItem direction="horizontal" label="District" required="true">
	<mx:ComboBox id="districts" labelField="name" dataProvider="{districtCollection}"
		open="{editMode}"
                editable="{editMode}"
		change="onDistrictSelected(event)"/>
</mx:FormItem>
 
<mx:FormItem required="true" label="Date:">
	<mx:DateField id="date" selectedDate="{report.startDate}" editable="{editMode}"/>
</mx:FormItem>

Open in new window

0
Comment
Question by:hallikpapa
  • 4
  • 3
8 Comments
 
LVL 19

Accepted Solution

by:
Jones911 earned 2000 total points
ID: 23664564
enabled="false"
<mx:ComboBox id="districts" labelField="name" dataProvider="{districtCollection}"
                open="{editMode}"
                enabled="{editMode}"
                change="onDistrictSelected(event)"/>

Open in new window

0
 

Author Comment

by:hallikpapa
ID: 23664577
Right, that's one thing I tried, except I mentioned that it makes everything dark grey & unreadable. How can I set it where it's just an off-white, or white, but still disabled?
0
 
LVL 19

Expert Comment

by:Jones911
ID: 23664743
If you make a custom skip for disabledIcon you can make it look how you want, but you will have to draw it up as a PNG.  Perhaps there is a style to change it.  I'll look more later.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:hallikpapa
ID: 23664926
Thanks. I thought I could make it work like this:
http://blog.flexexamples.com/2008/07/19/setting-the-label-color-on-a-disabled-combobox-control-in-flex/

My code is almost the same, except I am not using a color picker. I just explicitly set the color value to #999999, but it isn't coming out as it should.

I can't tell if the text color is changing, because the background color is so dark and I can't figure out how to make that not change between enable/disable.

But they seem to accomplish this in that demo....
0
 
LVL 37

Expert Comment

by:zzynx
ID: 23668083
>> My code is almost the same, except...
Please show us your code
0
 
LVL 19

Assisted Solution

by:Jones911
Jones911 earned 2000 total points
ID: 23670473
Use:   disabledIconColor="#FFFFFF" or what ever color you need.
0
 

Author Comment

by:hallikpapa
ID: 23674155
The combobox is dark grey, text is unreadable. Not like on the URL i posted above. It looks like the text color is the only thing changing when disabled, whereas the background on my combo box goes dark grey. I checked the main.css, and there is no entry for FormItem.



<mx:FormItem direction="horizontal" label="District" required="true">
						<mx:ComboBox id="districts" labelField="name" dataProvider="{districtCollection}"
							change="onDistrictSelected(event)"
							enabled="{editMode}"
							disabledColor="#999999"
							disabledIconColor="#FFFFFF"
							/>
					</mx:FormItem>

Open in new window

0
 

Author Comment

by:hallikpapa
ID: 23675448
The problem was I was disabling the combobox, and not the form item. Thanks.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
The following information will get you familiar with your new DV server, including the (mt) Account Center, the Plesk Control Panel, our world-renowned support department and the rest of the (mt) tools that come with your new service.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question