This project is read-only.

Editable FixedRows ?

Jun 18, 2009 at 1:16 PM

Perhaps I haven't really well understood the difference between FixedRows and  RowHeaders, but I'm trying to do to a text editor with several line types and I need a Row header for each one.

The question is how can manage the row header which is always displayed at the top of the grid when the user scrolls ? What I observed is that the "top" row(s) which is/are always on top is/are the FixedRow(s). Am I right.

Is there a way to change that or to make a non-RowHeader but fixed editable ?

Example: the 3 first lines of my grid are:

  1. RowHeader for "title line" 
  2. Title line (a string describing grid content, in my case a cell which is spanning all following columns)
  3. RowHeader for "main" line type

What I would have is the third line as fixed header when the user scrolls or, better, the 3 first lines fixed (what I've done with grid.FixedRows = 3), but the thiing is that the line #2 should be editable by user. I can "play" manually with an "external" textbox, but perhaps someone which knows SourceGrid better than me has an idea...

An image which perhaps better illustrates what I need than my approximate English:

Jun 19, 2009 at 9:50 AM

So the problem is that the light blue line is not editable, right?

Jun 20, 2009 at 8:24 AM

Yes, it's right.

I would liek to have this line editable like all others.

I fould a "workaround" with the Editable Header sample,  so I could make this line editable, but the doesn't work exacly the same and the line/cell isn't selectable.
BUt for the other cells, the are editable on Doubleclick and also on KeyDown, which isn't possible if I can't select/focus the cell

So if there is a way to make this line working "exactly" like a non fixed cell, I'm interested in it!

Jun 22, 2009 at 2:25 PM

You can remove the unselectable controller.

RemoveController(Controllers.Unselectable.Default);

 

Jun 22, 2009 at 2:51 PM
Edited Jun 22, 2009 at 3:19 PM

 

It's already what I've done, based on the EditableHeader sample, but doesn't seems to have any effect.
Where should I do insert the "RemoveController" command ?


private class EditableFixedCell : SourceGrid.Cells.Cell
{
private static FixedCellEditing fixedCellEditing = new FixedCellEditing();
static EditableFixedCell()
{
}

public EditableFixedCell(object value, SourceGrid.Cells.Editors.EditorBase fcEditor)
: base(value)
{
// Set the editor
fcEditor.EditableMode = SourceGrid.EditableMode.DoubleClick
Editor = fcEditor;

//Remove the unselectable Controllers
RemoveController(SourceGrid.Cells.Controllers.Unselectable.Default);
}
 }

 

Jun 22, 2009 at 3:26 PM

And

grid[1, 2].RemoveController(SourceGrid.Cells.Controllers.Unselectable.Default);

also doesn't work.
What am I doing false?

Where/when should I use "RemoveController"?

Jun 23, 2009 at 7:10 AM

jray,  i've actually played with the code and saw that in the trunk version there are some bugs with the drawing code for Selection.

The problem is that you can not select at the same time both normal rows, and fixed rows.  Well, at least now. I will have to think over how fixed rows are supposed to work.

 

About your problem:  your "feature" is also related to this Selection and FixedRows problem. So i can not help you at the moment. After this selection/fixed rows will be solved, then you will probably be able to achieve what you want easily with SourceGrid

 

Jun 23, 2009 at 7:39 AM

OK, thanks for the tests and the reply.

I've played with an "EditableFixedCell" as in my example above and I've added a controller to allow "SingleEdit":

            private class FixedCellEditing : SourceGrid.Cells.Controllers.ControllerBase
            {
                public override void OnMouseDown(SourceGrid.CellContext sender, MouseEventArgs e)
                {
                    base.OnMouseDown(sender, e);

                    if (e.Button == MouseButtons.Left)
                        sender.StartEdit();
                }
            }

But I would be very happy if it was also possible to select the FixedCell.

So I stay tuned I wait for the next update ;)

Jun 23, 2009 at 3:04 PM

Ok!   Glad to hear that it works for you at the moment.

 

You could also help me by sharing your vision of how fixed rows can be selectable.  To be more specific:

1. Say i have a grid with 5 fixed rows, and 50 normals rows.   Now if i scroll down, so that in the screen i see my 5 fixed rows, and rows from 20 to 30.

 

If you move mouse while mouse button is pressed from row 25 up to row 0, how selection behaves?


Does the grid scroll up, and do not let you select fixed rows?

or does it allow to select fixed row immediately? (thus, the selection is with a big hole).

 

Jun 23, 2009 at 4:27 PM
Edited Jun 23, 2009 at 4:29 PM

Hem, yes, I see that it's not so easy :D

In me case I'm only looking for a way to allow a single cell selection in a fixed row, because a cell should be editable and I think that it is pretty if the way to edit this cell is the same as for the other cells: in my case DoubleClick or Selection (SingleClick)+KeyDown.
Multi-selection/Drag&Drop should not be available for FixedRows and if I begin a "normal" selection in the "normal" rows and goes up, it shouldn't be possible to extent the selection to the fixed cells.

But I understand that's it's not so easy to program and to decide which solution is the best. And I answer for my only needs.
If you ask this to 5 people you will perhaps have 5 answers !!