Datagrid Del key issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bule
    Indigo Rose Customer
    • May 2005
    • 1116

    Datagrid Del key issue

    I am toying around with Datagrid plugin again and have a situation here:

    I have datagrid in list mode with several rows.
    Only one column should be editable. I solve this with OnSelection Event like this:
    Code:
    if Column==3 then
    	DataGrid.SetEditable("dIzrEdit", true);	
    else
    	DataGrid.SetEditable("dIzrEdit", false);
    end
    However, now I have an issue where, if the user clicks once on the cell in column 3 and presses Del, entire row is blanked. This behavior is completely unacceptable in my situation. Is there a way to intercept this behavior? Is it possible to disable deletion of rows via Del key?
    Never know what life is gonna throw at you. ZubTech
  • bule
    Indigo Rose Customer
    • May 2005
    • 1116

    #2
    After several unsuccessful trials, my brilliance has proven itself again!

    Here is the code that I use now to remedy the 'Del' situation I had:

    On Selection Changed:
    Code:
    irow=Row;
    i_id=DataGrid.GetCellText("dIzrEdit", Row, 0);
    i_sa=DataGrid.GetCellText("dIzrEdit", Row, 1);
    i_nz=DataGrid.GetCellText("dIzrEdit", Row, 2);
    i_gr=DataGrid.GetCellText("dIzrEdit", Row, 4);
    DataGrid.SetEditable("dIzaEdit", false);
    if Row == 0 then
    	irow=nil;
    elseif Column==3 then	
    	DataGrid.SetEditable("dIzaEdit", true);
    end
    On Cell Changed:
    Code:
    if irow then
    	DataGrid.SetCellText("dIzrEdit", irow, 0, i_id, false);
    	DataGrid.SetCellText("dIzrEdit", irow, 1, i_sa, false);
    	DataGrid.SetCellText("dIzrEdit", irow, 2, i_nz, false);
    	DataGrid.SetCellText("dIzrEdit", irow, 4, i_gr, false);
    end
    So simple and effective... it now even utilizes the 'Del' key to clear the column no.3 (in the selected row)!
    Last edited by bule; 01-22-2007, 08:27 AM.
    Never know what life is gonna throw at you. ZubTech

    Comment

    • Roboblue
      Forum Member
      • Dec 2003
      • 892

      #3
      Good tip.
      I haven't done a thing with the datagrid, yet.
      Need ideas and examples
      (little waif standing with empty soup bowl held out)
      More...Please?

      Comment

      Working...
      X