Jump to content


Photo

Editing formatted TNxNumberColumns


  • Please log in to reply
1 reply to this topic

#1 uli

uli
  • Members
  • 26 posts

Posted 16 November 2006 - 06:01 PM

Hi all!

I've trouble to make formatted TNxNumberColumns (in my case FormatMask = '#0.00' and Precision = 2) behave sensible if the user starts editing them. Suppose he navigates to one of these cells and types 5678.
  1. without coEditorAutoSelect: The user get's 5.00678, because the grid formats the cell text after typing the first character.
  2. with coEditorAutoSelect: The user get's 678, because after typing the first character the cell text (5.00 at this moment) is autoselected and gets overwritten by the following characters.

Do you know of a solution? I don't care much if coEditorAutoSelect is enabled or not - however typing 5678 should result in a cell text of 5678. smile.gif

Thanks in advance,
Uli.

#2 uli

uli
  • Members
  • 26 posts

Posted 17 November 2006 - 03:03 PM

QUOTE (uli @ Nov 16 2006, 06:01 PM) <{POST_SNAPBACK}>
without coEditorAutoSelect: The user get's 5.00678, because the grid formats the cell text after typing the first character.

Maybe I've found a solution to this:
  1. In TNxCustomGridControl.EditCell, delete the variable EditText and all of its occurences.
  2. Replace the line "Columns[ACol].UpdateEdit;" with
    CODE
      if Length(AText) > 0 then
        InplaceEdit.Text := AText
      else
      begin
        InplaceEdit.Text := Cells[ACol, ARow];
        Columns[ACol].UpdateEdit;
      end;
This leaves the "Key" parameter that TNxCustomGrid.KeyPress passes to EditCell as "AText" untouched (=unformatted) but retains the old behaviour in all other cases AFAICT.

Regards,
Uli.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users