Is it possible to programmatically create an UltraComboCalendar and display it at a given Point in an UltraGrid?
For example: I have an UltraGrid with a Checkbox column, when the cell is clicked the checkbox is checked. As the cell is clicked (or when the checkbox is checked), I'd like to programmatically create an UltraComboCalendar and have it draw next to the cell that was clicked. The selected date will then be added to another control's Text property.
I've been able to create the UltraCalendarCombo when the cell is clicked:
var ucc = new UltraCalendarCombo(); // the UltraGrid to attach the calendar // (just assumed it had to be added to the controls) ugLLTasks.Controls.Add( ucc ); ucc.BackColor = SystemColors.Window; ucc.DateButtons.Add( new DateButton() ); // general location for testing ucc.Location = new Point( 200, 200 ); ucc.Name = "uccTempServiceDate"; ucc.NonAutoSizeHeight = 21; ucc.Size = new Size( 100, 21 ); ucc.Show();
The problems I'm running to:
1. The only events I have to work with right now are from the CellChange events (object sender, CellEventArgs e) and I can not find a Point for the Location property of the UltraCalendarCombo.
2. I'm not sure how to programmatically show/hide the calendar (sort of tied to #3).
3. When I've added GotFocus and LostFocus events to the UltraCalendarCombo, the events never fire.
Any guidance or advice would be appreciated.
Thanks!::k::
nCubed said:3. When I've added GotFocus and LostFocus events to the UltraCalendarCombo, the events never fire.
nCubed,
Once you have created your UltraCalendarCombo, you will need to set it as the editor of one of the UltraGrid's columns. Since the UltraCalendarCombo implements IProvidesEmbeddableEditor (the interface that is required for a control to be embedded as an UltraGrid cell editor), this is somewhat simple. I recommend setting up the UltraCalendarCombo prior to setting it as an UltraGridColumn's editor. Once you have set up the UltraCalendarCombo, get a reference to the column you want to use the calendar in and set its EditorControl property. For example:
this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].EditorControl = this.ultraCalendarCombo1;
For more information on embedding editors into the UltraGrid, please see this article in our online documentation.
This approach should eliminate issues 1 and 2. If you still encounter issue 3 after using this approach, please let me know.
~Kim~