Jump to content


Photo

AfterEdit don't happen on empty cell ?


  • Please log in to reply
12 replies to this topic

#1 qi130

qi130
  • Members
  • 23 posts

Posted 26 October 2007 - 11:49 AM

After creating & populating a row, I code the following
CODE
NextGrid1.EditCell(1,i,'New Item');


The cell is in edit mode.

But if I clear the cell, the AfterEdit event never occurs !

How can I control the cell content in this case ?

I try next the EditAccept event.... but NextGrid1.Cell[ACol,ARow].AsString is always an empty string.

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 26 October 2007 - 02:33 PM

Hello qi,

Can you please tell me what do you think with "clear the cell":

1) Enter in edit-state and clear all text with Delete or Backspace and then finish editing
2) Press ESC key and exit from edit state.

When Esc key is pressed, there is no call for OnAfterEdit event.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 qi130

qi130
  • Members
  • 23 posts

Posted 26 October 2007 - 05:18 PM

Hi Boki

It's the #1.

Cursor is at the end of the string 'New Item'. Then, backspace or select all+del, then clic outside the cell.

Regards.

#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 30 October 2007 - 10:23 PM

Hello Qi,

I have test it several time and for me all work fine blink.gif

Do I need to do something more to introduce it?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 qi130

qi130
  • Members
  • 23 posts

Posted 31 October 2007 - 12:15 PM

QUOTE (Boki (Berg) @ Oct 30 2007, 11:23 PM) <{POST_SNAPBACK}>
Do I need to do something more to introduce it?


May be...

Can you tell me which events occur when I click outside the cell I'm currently editing ?

#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 31 October 2007 - 01:27 PM

Hello Qi,

There is no event when editing is canceled. If edit is completed (new value is added/changed), OnAfterEdit occur.

I agree that new event when editing is finished (canceled or accepted), need to be added. I will add it as soon as possible.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#7 Shaman

Shaman
  • Members
  • 16 posts
  • Gender:Male

Posted 02 November 2007 - 11:24 AM

QUOTE (Boki (Berg) @ Oct 31 2007, 01:27 PM) <{POST_SNAPBACK}>
There is no event when editing is canceled. If edit is completed (new value is added/changed), OnAfterEdit occur.

I agree that new event when editing is finished (canceled or accepted), need to be added. I will add it as soon as possible.


I think that Grid must call "OnBeforeEdit" when Grid open any inplace editor
and call "OnAfterEdit" when Grid close inplace editor.

Other events must be fired in specific cases. It is logical.


With best wishes.

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 02 November 2007 - 11:31 AM

Hello Shaman,

I agree that this is a problem. Because OnAfterEdit is already reserved for successfully editing (maybe many users are using it), I will like to add new edit when editing is finished no matter how.

I only don't know which will be good name be for this event sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#9 Shaman

Shaman
  • Members
  • 16 posts
  • Gender:Male

Posted 02 November 2007 - 11:55 AM

QUOTE (Boki (Berg) @ Nov 2 2007, 11:31 AM) <{POST_SNAPBACK}>
I only don't know which will be good name be for this event sad.gif


May be "OnOpenEditor" and "OnCloseEditor"?

The most impotant task - find out when Grid in edit mode.

#10 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 02 November 2007 - 12:29 PM

Hello,

Maybe OnEditExit? I will most probably add this kind of event in next 1-2 days.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#11 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 03 November 2007 - 01:42 PM

Hello,

I have added OnEditExit event. This event have no parameters.

This event occur when editing is over, not matther if is accepted or not. This event is last event in editing events array.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#12 Shaman

Shaman
  • Members
  • 16 posts
  • Gender:Male

Posted 06 November 2007 - 09:47 PM

Thanks. Very suitable event.

#13 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 22 November 2007 - 09:28 PM

Hello Shaman,

If you already installed v4.2.1, please change next procedure:

CODE
procedure TNxCustomGridControl.EndEditing;
begin
    if (Assigned(InplaceEdit)) then
    begin
    ShowWindow(InplaceEdit.Handle, SW_HIDE);
    if gtEdit in GridState then RefreshCell(FEditingCell.X, FEditingCell.Y);
    if gtInput in GridState then RefreshColumn(Columns[FInputingColumn], gaInput);
    TGraphicsProvider.SetClipingRect(Canvas, ClientRect);
    end;
  if gtEdit in FGridState then
  begin
    DoEditExit; { event }
  end;
    FGridState := FGridState - [gtEdit, gtInput];
  FEditingCell := Point(-1, -1);
  if FInputingColumn <> -1 then
  begin
    Columns[FInputingColumn].Input := False;
    FInputingColumn := -1;
  end;
  InplaceEdit := nil; { important }
end;


in NxCustomGridControl.pas file (Sources\Next Grid).

This will cause that this event is called ONLY after grid exit from edit cell state (not from Input state too).

I hope that this is correct behaviour.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users