Hi Sames,
I want to emulate the behavior of an Access table view in a Grid, so that there's always an "empty" line at the bottom where new data can be added. I'm subscribing to CellBeginEdit and CellFinishedEdit to store the old value and add a row if the user has changed the cell value. While I'm not sure if this is the "correct" way to handle this, accessing the contents with (grid cellAtPoint: anAnnouncement location) value works fine. Until I decide to get fancy and switch line numbers on. The announcement's location now is 3@1, where it was 2@1 before. Makes sense, since now there's an additional column in front. However grid cellAtPoint: 3@1 is one field to the right of the field I'm editing, hence it does not change and I get no additional row. What's the preferred way to handle this situation? Thanks, s. |
Stefan,
>Hi Sames, > >I want to emulate the behavior of an Access table view in a Grid, so >that there's always an "empty" line at the bottom where new data can be >added. > >I'm subscribing to CellBeginEdit and CellFinishedEdit to store the old >value and add a row if the user has changed the cell value. While I'm >not sure if this is the "correct" way to handle this, accessing the >contents with > > (grid cellAtPoint: anAnnouncement location) value > >works fine. Until I decide to get fancy and switch line numbers on. >The announcement's location now is 3@1, where it was 2@1 before. Makes >sense, since now there's an additional column in front. However >grid cellAtPoint: 3@1 is one field to the right of the field I'm >editing, hence it does not change and I get no additional row. > >What's the preferred way to handle this situation? This probably needs to be rationalized better internally. At one point I had row headers be 0 @ y, but decided against that, even though column headers are x @ 0. I don't have a preferred way to handle this I'm afraid. For now, hack it up I'm afraid. And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
On Fri, 03 Aug 2007 12:25:07 -0500
"Samuel S. Shuster" <[hidden email]> wrote: > >I'm subscribing to CellBeginEdit and CellFinishedEdit to store the > >old value and add a row if the user has changed the cell value. > >While I'm not sure if this is the "correct" way to handle this, > >accessing the contents with > > > > (grid cellAtPoint: anAnnouncement location) value > > > >works fine. Until I decide to get fancy and switch line numbers on. > >The announcement's location now is 3@1, where it was 2@1 before. > >Makes sense, since now there's an additional column in front. However > >grid cellAtPoint: 3@1 is one field to the right of the field I'm > >editing, hence it does not change and I get no additional row. > > > >What's the preferred way to handle this situation? > > This probably needs to be rationalized better internally. > > At one point I had row headers be 0 @ y, but decided against that, > even though column headers are x @ 0. This would be nice, IMO. Very symmetric, hence easy to remember. > > I don't have a preferred way to handle this I'm afraid. For now, hack > it up I'm afraid. Heh ... I have no problems hacking something up, I only thought that I might have overlooked something. There is a method somewhere in the GridArtist (IIRC), where you add on if row headers are set. I'll just do something like that. BTW: Is there a way to change the vertical alignment of grid cell contents? I think I saw something somewhere but can't find it anymore. Single line text items would look better besides multi-line cells if they were top-aligned. Thanks, s. |
On Fri, 3 Aug 2007 19:41:50 +0200
Stefan Schmiedl <[hidden email]> wrote: > Heh ... I have no problems hacking something up, I only thought that > I might have overlooked something. There is a method somewhere in the > GridArtist (IIRC), where you add on if row headers are set. I'll just > do something like that. Hackety hack... I've introduced GridCellAnnouncement as a subclass of GridAnnouncement, moved the Cell...Announcements below it, pulled up the location instance variable and accessors and modified GridCellAnnouncement>>location to observe hasRowHeaders. Works. Fun. Now I only wish I'd remember to start a new changeset before embarking on journeys like these... s. |
In reply to this post by Stefan Schmiedl
Stefan:
> BTW: Is there a way to change the vertical alignment of grid cell > contents? Nope, just horizontal for the text columns. Some day maybe... And So It Goes Sames ______________________________________________________________________ Samuel S. Shuster [|] VisualWorks Engineering, GUI Project Smalltalk Enables Success -- What Are YOU Using? |
Free forum by Nabble | Edit this page |