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.
Hello Kim and Brian,
Thanks for the replies. I'm not sure I descirbed the environment properly.
The grid displays summary data; there is a detail pane above the grid. When the user clicks on a row, the detail pane shows the related information of the row clicked.
The user can make changes to the detail pane, but not the grid. The only editable cell on the grid itself is the checkbox control I described in my previous post.
When the user clicks the checkbox, there is some validation that goes on. One piece of the validation is for a DateTime field in the details pane. If the validation fails, the checkbox can not be checked.
In this case, if the DateTime validation fails, we want an UltraCalendar to pop up next to the checkbox where the user can quickly correct the DateTime and the result sets the value of the UltraCalendar field in the details pane.
fwiw: Our data is dynamically bound to the grid at runtime and we don't have a column that is defined for the DateTime field we are validating in the details pane. Nor can we add another column just for this UltraCalendar.
I'm happy to try what you've suggested, but wanted to be sure that you understood the problem at hand in full before we moved forward.
With that said, is there another method we may want to pursue?
nCubed said:we want an UltraCalendarCombo to pop up next to the checkbox where the user can quickly correct the DateTime and the result sets the value of the UltraCalendar field in the details pane.
nCubed said:With that said, is there another method we may want to pursue?
Thanks for the replies and the ideas. I think we've been able to get this working.
One other question: Is it possible to show the UltraCalendarCombo w/o the combo box? Or is there another UltraCalendar control that we could use that just has a calendar?
Thanks Brian. Finally had some time to look at this again today and the lead on using the UltraMonthViewMulti class got me there.
I essentially just created a helper class with a Panel and tossed in a label for the header and the UltraMonthViewMulti calendar. And then created a singleton to be used whenever needed on the form.
Does the job very nicely.
UltraCalendarCombo basically displays an UltraMonthViewMulti control in a dropdown. You could roll your own dropdown calendar by using our DropDownManager class to show an UltraMonthViewMulti in a top-level window.