Can you tell me what I'm doing wrong ?
Why does the cell not enter edit mode with this ... the correct line is selected and everything,but I have to use the mouse to click the cell to enter it's edit mode-> I want the cell in edit-mode right away ...
This is my code:
_ugFinishDateChanges.DataSource = changes;
if (changes.Count > 0){ _ugFinishDateChanges.Selected.Rows.Clear(); _ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]); _ugFinishDateChanges.Focus(); _ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0]; _ugFinishDateChanges.PerformAction(UltraGridAction.EnterEditMode);
_ugFinishDateChanges.ActiveCell = _ugFinishDateChanges.Rows[0].Cells[
"ReasonForChange"];
//why does the actual "ReasonForChange" CELL not get the focus ??
}
A timer will work. Another way to do it would be to use BeginInvoke to call a method from the Form_Load event so that the code is not executed until after the loading of the form is finished.
Another option would be to use the Form_Activate event and use a flag so that the code only fires once.
Alright, as Mike said – it is not possible to set focus on a control on form load – the only solution left is to use a timer with an interval of 100 and call a method that make the cell enter edit mode so users can just type in without the mouse click.
I have prepared the following code for you and it worked.
private void Form1_Load(object sender, EventArgs e)
{
timer1.Start();
private void timer1_Tick(object sender, EventArgs e)
timer1.Stop();
EnterEditMode();
private void EnterEditMode()
this.ultraGrid1.Focus();
this.ultraGrid1.Rows[0].Cells[0].Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
this.ultraGrid1.Rows[0].Cells[0].Activate();
UIElement uiElement = this.ultraGrid1.Rows[0].Cells[0].GetUIElement();
EmbeddableUIElementBase embeddableElement = uiElement.GetDescendant(typeof(EmbeddableUIElementBase)) as EmbeddableUIElementBase;
this.ultraGrid1.Rows[0].Cells[0].EditorResolved.EnterEditMode(embeddableElement);
Hi !
It works OK to enter edit mode by CLICKING in the cell ... it has always worked, and that's not the problem
But I want the cell to START in edit-mode when I open up the form ( another form opens this form )
So that's why I put the code in FORM_LOAD .... how I can I make the cell START in edit-mode, right upon the loading of the form ??
rgd,EE
try the following code, it helps you enter cell edit mode on mouse click.
Infragistics.Win.UltraWinGrid.
UltraGridBand ultraBand = ultraGrid1.DisplayLayout.Bands[0];
ultraBand.Columns[
"ColumnNameHere"].CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
"ColumnNameHere"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;
This is the complete code ... where should it be if not in FORM_LOAD ?
private
e)
//nota e- svona til a stasetja mijum ResPlanner ??? arf a stylla lka property-i: StartPosition Desigernum forminu
//this.Parent = (Form)sender;
.GetFinishDateChangesForProject(_projectIdBeingWorkedWith);
.MinValue)
();
newChange.ChangeDate =
.Now;
newChange.ChangeID = -1;
newChange.FinishDate = _changeDateSelectedInHistoryControl;
newChange.ProjectID = _projectIdBeingWorkedWith;
newChange.ProjectName = _projectNameBeingWorkedWith;
changes.Add(newChange);
(changes.Count > 0)
_ugFinishDateChanges.Selected.Rows.Clear();
_ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]);
_ugFinishDateChanges.Focus();
_ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0];
];
_ugFinishDateChanges.ActiveCell.Value =
;
_ugFinishDateChanges.PerformAction(
.EnterEditMode);
_ugFinishDateChanges.ActiveRow.Update();
//hvernig set g fkusinn "ReasonForChange" celluna ????
_lblProjectName.Text = _projectNameBeingWorkedWith;