Re: Save Query in frmEditGrid

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: pg(at)kuhnsteffen(dot)de
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: Save Query in frmEditGrid
Date: 2010-09-13 19:47:05
Message-ID: 4C8E7FB9.6070503@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi again :)

Le 13/09/2010 20:55, Steffen Kuhn a écrit :
> [...]
> doing around with the context menu I encountered another issue,
> I wasn't able to solve my self:
> 1: bring a cell in edit mode do not change it.
> 2.1: stay in the not edited cell an click row label or some emtpy space
> on the right border and close
> 2.2: choose another cell in the same row do not change anything and close.
>
> => you will be asked if you want to save even though you didn't change
> the data.
>

Yes. Just another bug...

> I could track this so far that frmEditGrid::OnCellChange is doing that
> right if the row also changes.
> I hope this helps you to spot the issue.
>

I probably can give you some hints on that one. As soon as you enter in
edit mode, the save menu is already enabled [1]. That's the one that
triggers the question dialog [2]. So, when a guy hits Escape, we should
simply call CancelChanges(), this way:

diff --git a/pgadmin/frm/frmEditGrid.cpp b/pgadmin/frm/frmEditGrid.cpp
index 5973434..d75afe2 100644
--- a/pgadmin/frm/frmEditGrid.cpp
+++ b/pgadmin/frm/frmEditGrid.cpp
@@ -881,6 +881,10 @@ void frmEditGrid::OnKey(wxKeyEvent &event)

break;

+ case WXK_ESCAPE:
+ CancelChange();
+ break;
+
default:
if (sqlGrid->IsEditable() && keycode >= WXK_SPACE &&
keycode < WXK_START)
{

When a guy chooses another cell or hits enter, with changing anything,
we should compare the current value with the old value. Which means we
need to remember the old value (probably in the OnEditorShown() method).

Try this. If it doesn't work out that well or if you don't find that
easy to do, I'll probably find some time to do it.

Right now, I'll get to your previous question.

[1]
http://github.com/postgres/pgadmin3/blob/REL-1_12_0_PATCHES/pgadmin/frm/frmEditGrid.cpp#L1146
[2]
http://github.com/postgres/pgadmin3/blob/REL-1_12_0_PATCHES/pgadmin/frm/frmEditGrid.cpp#L905

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2010-09-13 19:51:28 Re: 1.12.0 release date
Previous Message Dave Page 2010-09-13 19:46:40 Re: 1.12.0 release date