I have a database that uses a tri-state column (integer) that currently uses 0=unknown, 1=yes, -1=no although those codes could change easily. In PHP I wrote a simple drop down that uses images a checkmark for yes, a X for no and blank for unknown. I'd like to use a similar type setup with ultragrid. is this possible? If so I could use some pointers in the right direction as I am just now experimenting with ultragrid.
Peter
You could do this using an UltraCheckEditor as the EditorControl of a grid column; in the 8.2 release, I *think*, there was a new GlyphInfo property that was added to the check editor that allows you to specify custom images for each of the states. You would still likely need to use a DataFilter to convert your values to a nullable boolean type, though, since 0 would be parsed as 'false' and I don't know how it would treat '-1'. There is already an example of a DataFilter for checkboxes in the KB that should help you out in this regard.
-Matt
ok, the UltraCheckEditor is looking like a good start here are my questions:
1. The "indeterminate" state appears to activate on hover...that seems unusual. I'd like to be able to cycle through yes-no-unknown, or checked->unchecked->indeterminate. I dont see how to do this
2. I cant seem to set the editor to the column. When I go to the Grid's properties for that column and select ColumnEditor, it shows (none) and the dropdown is empty.
3. Should I be thinking about a multi-column drop down where the first column is an image and the 2nd column is the text (0,1,-1) and the width of column 2 is 0?
1) The state shouldn't be changing when you mouse over the control, I'm not really sure why it would be doing this unless you set a glyph for the hot-tracked state instead of the normal indeterminate state. Clicking on the check should cycle through the 3 different possible states.
2) You should be able to set the EditorControl of a column to the instance of the UltraCheckEditor that exists on your form. If it's not showing up in the list, I'm not really sure offhand what could be causing that problem.
3) I still don't see why you would need to do this, you should be able to change all of the images with the glyphs on the check editor. If you don't have a later version that has this functionality, you might have to hack around it, possibly using a ValueList. If you do have the appropriate version, I still think that the DataFilter is the best and cleanest approach.