Re: Save Query in frmEditGrid - Mailing list pgadmin-hackers

From Steffen Kuhn
Subject Re: Save Query in frmEditGrid
Date
Msg-id 20100914110936.526AD304AA06@bmail00.one.com
Whole thread Raw
In response to Re: Save Query in frmEditGrid  (Guillaume Lelarge <guillaume@lelarge.info>)
Responses Re: Save Query in frmEditGrid
List pgadmin-hackers
Hi Guillaume,

checking for changed values is what I tried to, but my place was
sqlGridEditor::EndEdit because this is already checked there.
But checking here, may be also in OnEditorHidden can be dangerous I think, because of
there might be previous changes that might be lost by just disableing 'Save' if one cell has not been changed.
This may also happen by doing CancelChange with 'ESC'.
I think there will be no other way as comparing the whole row.

I would prefer you fixing this, it's to hot for me right now.

Regards Steffen


On 13.09.2010 21:47 "Guillaume Lelarge" <guillaume@lelarge.info> wrote:
> 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/fr
> m/frmEditGrid.cpp#L1146
> [2]
> http://github.com/postgres/pgadmin3/blob/REL-1_12_0_PATCHES/pgadmin/fr
> m/frmEditGrid.cpp#L905
>
>

pgadmin-hackers by date:

Previous
From: "pgAdmin Trac"
Date:
Subject: Re: [pgAdmin III] #234: Query->Explain Options->Verbose/Analyze unresponsive in 1.10.5 on OS X
Next
From: Guillaume Lelarge
Date:
Subject: Re: Save Query in frmEditGrid