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 ??
}
The code you have here is setting the ActiveCell, but that doesn't put the cell into edit mode. Active and in edit mode are two totally different things.
What you need to do is, after you set the ActiveCell, call the PerformAction method on the grid and tell it to EnterEditMode.
Hi Mike!
I've already tried that, by switching the lines like this ... but it still won't enter EDIT-MODE( the cell is correcty selected and everything but I have to CLICK IT so I can actually write any text inside the cell )
This is my code - it's NOT working:
if
(changes.Count > 0)
{
_ugFinishDateChanges.Selected.Rows.Clear();
_ugFinishDateChanges.Selected.Rows.Add(_ugFinishDateChanges.Rows[0]);
_ugFinishDateChanges.Focus();
_ugFinishDateChanges.ActiveRow = _ugFinishDateChanges.Rows[0];
];
_ugFinishDateChanges.PerformAction(
.EnterEditMode);
//hvernig set g fkusinn "ReasonForChange" celluna ????
I also tried setting this below:
UltraGridAction.EnterEditMode);
_ugFinishDateChanges.ActiveCell.SelectAll();and this latter row gives me what I've would have thought, when NOT in edit-mode:"Can't access SelectionStart unless the Editor is in edit mode"
So why is it still not in EDIT mode ??
rgd,EE.
What event is this code in? You can't do this in Form_Load because DotNet will not allow you to set focus to a control before the form is displayed.
It's in the Form_Load ... where would you recommend doing this ?
This should happen when another form(form1) has opened this form with Grid (form2)
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);
_ugFinishDateChanges.ActiveCell.Value =
;
_ugFinishDateChanges.ActiveRow.Update();
_lblProjectName.Text = _projectNameBeingWorkedWith;
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;
Hi Mike
I was refering to this:
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)) asEmbeddableUIElementBase;
this.ultraGrid1.Rows[0].Cells[0].EditorResolved.EnterEditMode(embeddableElement);
Hi Mariela,
mariela77 said:How does that look in VB ?
Could you be more specific? This is a 6-year-old thread with a lot of different code in it for various things. So I don't understand what you are asking.
How does that look in VB ?
The reason is that cell editing is realized with a TextBox control, which is parented to the grid and positioned inside the cell. This can only be accomplished when the control has a visual presence.
I was having trouble allowing users to add a grid row by clicking an 'Add Line' button and putting the user in the first cell of the new row in edit mode. The row would add to the grid but the cell was not in edit mode so their text was getting erased when they moved out of the cell and the cell would not respond to the tab key.
Adding the piece with the UI element resolved my issue - thanks! However, I'm wondering why this was necessary??