« Icons in ComboBox | Main | The Future of List Classes (Tree, TileList, DataGrid, etc) »

Disabling List Selection

Recently a couple of FlexCoders asked about how to prevent certain entries from being selected in a List or Tree or ComboBox. I cobbled this together. Usual caveats apply. Hopefully it will help.

Run Demo
Download Source

Comments

Hi Alex,

This is just a general question, not on lists.

But does flex have any way to read files syncronously?

You see, I am developing an app that really needs to read a lot of small files, in order. Having to spawn off a new event for each and every file totally will make my code into a mess.

The files will be read locally. I just want to read my files syncronously.

Is this possible within flex? I tried making a busy loop that checked for a flag set by the loaded event, but it seemed like the loop froze the event! Catch-22!

I don't suppose you know of some clever little insider trick that could be used to allow events to fire from within busy loops, so that I can freeze my code's execution until the file is loaded? Just like how reading files is supposed to work, normally. Except without the excessive CPU usage that such a loop creates :(

--------------

There is no synchronous file I/o in the flash player. Note also that in general, a server-based app cannot access local files on the client computer. If you use Apollo/AIR, you should get much better file i/o performance, but web-based stuff will still be asynch.

Generally, you do not loop waiting for file i/o to finish. Listen for the COMPLETE event instead.

Thanks alex for the interesting informations. The Download Link is very usefully and works excellent. Thanks for share it! Werbeagentur

Thanks Alex for the Demo and Download link... Very usefully and helps very great ;)

Thanks

@ http://www.medienstern.de/werbeagentur/

Hi Alex,
I'm seeking the disabling combobox. Your posting give me some ideals. And now, I have implmented the disabling ComboBox and List using my method.
Your blog is very helpful for me.Thanks.

I have put my disabling ComboBox to my blog http://wmcai.blog.163.com/blog/static/4802420088945053961/

I am looking for something like this for a datagrid.

------------------------
Alex responds:

You should be able to apply the same principles to DataGrid subclass

I have a problem with this code... When I add more items to the list, the keyboard selection goes crazy (I think it's because of the vertical scrollbar).

Thanks a lot!

-------------------
Alex responds:

Well, like I say on every post, usual caveats apply. These examples are unsupported and not fully tested. If you find the solution feel free to post it. You can also ask on FlexCoders as someone may have already found a solution.

Hi Alex,

help me out from this problem,I am using a dataGrid in that one checkbox row is there,when i select that checkbox the entire row has to be disable means i cant edit that row.Any suggestions regording on this.

Regards
Sreekanth K

-------------------
Alex responds:

You should be storing the disabled state either in the dataProvider or in some other map, and all other editors should be looking at that spot to determine their enabled state.

Hi Alex,

I'm afraid I don't know what your "usual caveats" are. If If I was guessing it would be that the code is "free for use anywhere (including commercial applications) but use at your own risk". Is this correct? If so you might consider adding a link to your "Usual caveats" in future blog posts.

Anyway, very helpful. Thanks,

Philip Wilder

------------
Alex responds:

That is a pretty good description of the usual caveats. Maybe I will formalize that someday.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)