I'm building a multi-select dropdown using an UltraTextEditor and an UltraGrid as my EditorButtonDropdown control. All works pretty well, but I want my dropdown to have the behaviour of a DropDownList, i.e. no editing in the textbox.
I've set the ReadOnly property to True, but unfortunately I still have a cursor in the text box.
I also want the grid to dropdown whenever I click on the text box. I can use the AfterEnterEditMode event to force a DropDown which works ok, however, when the control Closes Up, the textbox is still in Edit Mode, so I can't repeat the trick.
So, (1) is there a way to prevent the cursor? I tried cancelling the control going into edit mode in the BeforeEnterEditMode event, however, this prevents me being able to dropdown the grid.
And (2), is there any way to programatically exit from Edit Mode?
Thanks,Campbell
jcwild said:So, (1) is there a way to prevent the cursor? I tried cancelling the control going into edit mode in the BeforeEnterEditMode event, however, this prevents me being able to dropdown the grid.
Well, the only thing I can think of is to set focus to the grid once it drops down. The TextBox can't show a cursor if it does not have focus.
jcwild said:And (2), is there any way to programatically exit from Edit Mode?
I'm not sure. Is there an ExitEditMode method on the control? Maybe there's a PerformAction option for exiting edit mode? Or maybe you should just be dropping down in the click event instead of (or in addition to) EnterEditMode.
Thanks, I've created a hidden dummy control on the user control to point the focus to, and that sorts that out, albeit a bit yucky.
There doesn't seem to be any ExitEditMode, nor a PerformAction on the textbox, however, the focus trick solves that problem. The Click event doesn't fire at all if you click into the textbox; only if you click on the dropdown button. I'm not sure why that is.
My solution with the BeforeEnterEditMode didn't work, because that interfered with the normal dropdown when clicking on the button, so I had to add a timer to the control fired from the BeforeEnterEditMode to dropdown when clicking on the textbox if it hadn't already dropped down, as there doesn't seem to be any way to differentiate between clicking on the button and clicking on the textbox.
So, a few yucky workarounds, but I seem to be there in the end.
It would be good if Infragistics could create a bespoke multi-select combo box though, as I'm sure many people would make use of this.
Cheers,Campbell