Editing datagrid cells

Peter Haworth pete at lcsql.com
Mon Jan 5 13:18:44 EST 2015


Thanks Simon.

I found a slightly different solution to my original problems which might
be of use to you.

To recap, they were: how to popup a contextual menu in the field editor and
how to recognize that the user has changed the data in the field editor but
not escaped/tabbed out of it.  The latter is necessary because the field
doesn't lose focus on OSX when you click a button, so no closeField happens.

For the former, I replaced the default field editor behavior with a custom
one (details are in the Datagrid Manual).  I then changed the mousedown
handler to check for button 3 and display my popup menu.  I think your
situation was how to check for return in the field editor and this behavior
has handlers for returnInField, enterInField and all the other common
handlers for fields.

For the second one, the datagrid sends a preOpenFieldEditor message with a
single parameter being the long id of the field editor.  I wrote a handler
for that message and stored the field editor id in a custom property of the
datagrid, much as you did in the EditValue handler.  When the user clicks
the button I provide to "apply" the changes, I check if the field editor
exists and if so, send a setDataOfLine to the datagrid with the field
editor contents.

Maybe that might be of some use to you.

Pete



Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>

On Mon, Jan 5, 2015 at 1:47 AM, Simon Knight <smk at anvic.net> wrote:

> I added a custom prop to store the name of the field being edited
> following a suggestion made on the Livecode forum.  I added this line to
> the EditValue handler in the Row Behavior script : set the cFieldName of
> grp "DgNotes" to pKey  -- store this for use in the custom field editor.
> Code in the custom field editor reads the value when it processes the key
> presses.
>
> Simon Knight
> smk at anvic.net
> Telephone : 05603 643965
> Mobile : 07963 077071
>
>
>
> > On 3 Jan 2015, at 09:07, Simon Knight <smk at anvic.net> wrote:
> >
> > Hi Pete,
> >
> > Unfortunately I don’t have any answers but I have a similar problem.  I
> am trying to detect a return in a specific field  on a datagrid form and so
> far I can either detect the return but not the name of the field (I just
> get the name of the field editor) or I can get the name of the field with
> no detection of the key press (because the keypress has gone to the field
> editor).
> >
> > Lest hope one of the experts answers our questions….
> >
> >
> > Simon Knight
> > smk at anvic.net
> > Telephone : 05603 643965
> > Mobile : 07963 077071
> >
> >
> >
> >> On 21 Dec 2014, at 21:22, Peter Haworth <pete at lcsql.com> wrote:
> >>
> >> Got a number of questions for the datagrid experts out there, all
> related
> >> to the editing of datagrid cells.
> >>
> >> How can I implement a contextual menu when the user right clicks on a
> cell
> >> that is being edited?  I tried using a mouseDown handler in a custom
> column
> >> handler but it doesn't seem to fire when the edit field is clicked.
> >>
> >> Tab and escape are ways of getting out of edit mode. If escape/tab have
> not
> >> been pressed to register the edit, the underlying datagrid data won;t
> have
> >> been updated so how can I get hold of the contents of the edit field
> for a
> >> cell if the user has not pressed escape or tab?
> >>
> >> Probably the root of the above questions but how can I get hold of the
> id
> >> of the field created by the datagrid to edit a cell?
> >>
> >> The datagrid library isn't happy if I send an EditCelll message to a
> cell
> >> that has been customized to contain, for example, an option menu. By
> "not
> >> happy", I mean that any instructions in the handler after dispatching
> the
> >> EditCell message are skipped.  I guess I should file a QCC report for
> that
> >> but in the meantime, how can I find the first column in the selected
> line
> >> that has not been customized to contain something other than straight
> text?
> >>
> >> Pete
> >> lcSQL Software <http://www.lcsql.com>
> >> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> >> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> >> _______________________________________________
> >> use-livecode mailing list
> >> use-livecode at lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list