Thread: Paste rows patch

Paste rows patch

From
"Edward Di Geronimo Jr."
Date:
Here's a fully functional version of my row pasting patch. It now
always pastes into the * row, and prompts if you want to skip over
serial columns or not. It should be good to go.

Ed

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Attachment

Re: Paste rows patch

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Edward Di Geronimo Jr.
> Sent: 09 May 2006 07:24
> To: pgadmin-hackers@postgresql.org
> Subject: [pgadmin-hackers] Paste rows patch
>
> Here's a fully functional version of my row pasting patch. It
> now always pastes into the * row, and prompts if you want to
> skip over serial columns or not. It should be good to go.

It's looking much better, however, I still think that if the cursor is
actually active in a cell then the paste should go to that cell, and
only in other cases to the new row. On Windows, the only way to do that
is ctrl-v or right-click->paste. The paste button and ctrl-v should
always do the same thing (though I wonder if that's an issue with
Windows doing the actual paste operation in the ctrl-v case) imo.

Whaddya think?

Regards, Dave.


Re: Paste rows patch

From
"Edward Di Geronimo Jr."
Date:
Quoting Dave Page <dpage@vale-housing.co.uk>:

> It's looking much better, however, I still think that if the cursor is
> actually active in a cell then the paste should go to that cell, and
> only in other cases to the new row. On Windows, the only way to do that
> is ctrl-v or right-click->paste. The paste button and ctrl-v should
> always do the same thing (though I wonder if that's an issue with
> Windows doing the actual paste operation in the ctrl-v case) imo.

I forgot about that issue. I think you're right, however, I don't
really know how to solve it. I think the solution is to detect if the
cursor is in an edit box, and call the edit box's Paste function if
so, however, I'm not sure how to tell if we're in an edit box or not.

Ed

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



Re: Paste rows patch

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Edward Di Geronimo Jr.
> Sent: 09 May 2006 15:00
> To: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Paste rows patch
>
> Quoting Dave Page <dpage@vale-housing.co.uk>:
>
> > It's looking much better, however, I still think that if
> the cursor is
> > actually active in a cell then the paste should go to that
> cell, and
> > only in other cases to the new row. On Windows, the only way to do
> > that is ctrl-v or right-click->paste. The paste button and ctrl-v
> > should always do the same thing (though I wonder if that's an issue
> > with Windows doing the actual paste operation in the ctrl-v
> case) imo.
>
> I forgot about that issue. I think you're right, however, I
> don't really know how to solve it. I think the solution is to
> detect if the cursor is in an edit box, and call the edit
> box's Paste function if so, however, I'm not sure how to tell
> if we're in an edit box or not.

We enable/disable the save button on the entry/exit of a cell - see
frmEditGrid::OnEditorShown() & frmEDitGrid::OnSave(). Does that look
robust enough to use to set a flag?

Regards, Dave.

Re: Paste rows patch

From
"Edward Di Geronimo Jr."
Date:
Quoting Dave Page <dpage@vale-housing.co.uk>:

> We enable/disable the save button on the entry/exit of a cell - see
> frmEditGrid::OnEditorShown() & frmEDitGrid::OnSave(). Does that look
> robust enough to use to set a flag?

Got a solution. I set a flag in OnEditorShown, and trapped the editor
hidden event to clear it. Here's a new patch.

Ed

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Attachment

Re: Paste rows patch

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Edward Di Geronimo Jr.
> Sent: 10 May 2006 00:43
> To: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Paste rows patch
>
> Quoting Dave Page <dpage@vale-housing.co.uk>:
>
> > We enable/disable the save button on the entry/exit of a cell - see
> > frmEditGrid::OnEditorShown() & frmEDitGrid::OnSave(). Does
> that look
> > robust enough to use to set a flag?
>
> Got a solution. I set a flag in OnEditorShown, and trapped
> the editor hidden event to clear it. Here's a new patch.

Nice - that works. Unfortunately I found another problem - the serial
column doesn't seem to work I suspect because you are looking for
columns that are PGOID_TYPE_SERIAL or PGOID_TYPE_SERIAL8, however they
actually get seen as int4's or int8's I believe. I'm testing with 8.1.3
and a table that looks like:

CREATE TABLE foo
(
  id serial NOT NULL,
  data1 text,
  data2 text,
  data3 text,
  CONSTRAINT foo_pkey PRIMARY KEY (id)
)
WITH OIDS;
ALTER TABLE foo OWNER TO postgres;

Regards Dave.

Re: Paste rows patch

From
"Edward Di Geronimo Jr."
Date:
Quoting Dave Page <dpage@vale-housing.co.uk>:

> Nice - that works. Unfortunately I found another problem - the serial
> column doesn't seem to work I suspect because you are looking for
> columns that are PGOID_TYPE_SERIAL or PGOID_TYPE_SERIAL8, however they
> actually get seen as int4's or int8's I believe. I'm testing with 8.1.3
> and a table that looks like:

That's odd. It works for me with Postgres 8.0.7. In the sqlTable
constructor, pgAdmin looks at the types and sets the type to one of
those serial types if it detects a nextval() attached to the column.
Looks like that detection doesn't work for 8.1.

Could you look at fixing that? Roughly around line 1150 in frmEditGrid.cpp.

Ed

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



Re: Paste rows patch

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-hackers-owner@postgresql.org
> [mailto:pgadmin-hackers-owner@postgresql.org] On Behalf Of
> Edward Di Geronimo Jr.
> Sent: 10 May 2006 16:41
> To: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Paste rows patch
>
> Quoting Dave Page <dpage@vale-housing.co.uk>:
>
> > Nice - that works. Unfortunately I found another problem -
> the serial
> > column doesn't seem to work I suspect because you are looking for
> > columns that are PGOID_TYPE_SERIAL or PGOID_TYPE_SERIAL8,
> however they
> > actually get seen as int4's or int8's I believe. I'm testing with
> > 8.1.3 and a table that looks like:
>
> That's odd. It works for me with Postgres 8.0.7. In the
> sqlTable constructor, pgAdmin looks at the types and sets the
> type to one of those serial types if it detects a nextval()
> attached to the column.
> Looks like that detection doesn't work for 8.1.
>
> Could you look at fixing that? Roughly around line 1150 in
> frmEditGrid.cpp.

Ah, yes - it was assuming a schema was always prepended to the sequence
name, and that the name was cast to text which is no longer the case in
8.1 (it's now cast to regclass). I modified it to detect both with or
without schema, cast to text or regclass.

And with that, another new feature is added :-). Thanks Ed. Patch
applied.

Regards, Dave.