Topic: Is it a bug or not in the Tablegrid ?

Hi again. I face a problem and do not know if this is a bug or not. In my example when I  insert a phone number direct in the tablegrid and press the enter key it doesn't store it instead it saves all the edit boxes ( ;ike pressing the Button 1 (save function) ))
see pic   [https://i.postimg.cc/Kzp3W1L2/Capture.png

Post's attachments

Attachment icon EnterButton.7z 274.27 kb, 243 downloads since 2020-04-30 

2 (edited by derek 2020-04-30 12:11:41)

Re: Is it a bug or not in the Tablegrid ?

Hi,
No, it's not a bug.
It happens because you have asked  the 'enter' key to do two different things in your project and they are conflicting.
1.  you want the 'enter' key to save the telephone number directly into the grid
2.  you also want the 'enter' key to save 'name' and 'sname' and close 'frmcreate'.
This is because you have defined frmcreate.button1 as the 'default' button (see the screenshot in the attachment), so whenever 'enter' is clicked, the action associated with that 'default' button is executed.  And the 'default' button takes priority.
To stop this conflict, the easiest thing is to remove the check mark from the 'default' property.
However, you could also temporarily disable the 'default' button whenever frmcreate.tablegrid1 is entered with a small script (see the attachment) to allow you to use the 'enter' key in both situations (notice how, when you move the mouse into frmcreate.tablegrid1, frmcreate.button1 is greyed out).
Derek.

Post's attachments

Attachment icon EnterButton.zip 465.59 kb, 253 downloads since 2020-04-30 

Re: Is it a bug or not in the Tablegrid ?

Thank' s, nice trick.

Re: Is it a bug or not in the Tablegrid ?

Hi derek.
I found a small problem. When I have a complete empty database (sqlite.db) and add new record when i try to insert the first record in the tele (tablegrid from the frmCreate ) it doesn't work. any idea?

5 (edited by derek 2020-05-04 23:24:38)

Re: Is it a bug or not in the Tablegrid ?

Hi,
It happens when you create a new person in your 'db' table and you add phone numbers before saving the new 'db' record - at that point, the program doesn't have the 'id' of the 'db' record to insert into the 'tele' table and so can't create the relationship between the two tables.
Probably the easiest way is to check in your script if your action is a 'NewRecord' and, if so, make the telephone tablegrid invisible and so force the new 'db' record to be saved first.
Unfortunately, it's one of the issues that you have with editable grids.
Derek.

Post's attachments

Attachment icon EnterButton.zip 466.25 kb, 237 downloads since 2020-05-05 

Re: Is it a bug or not in the Tablegrid ?

Well i tried it also before. Thank's for your help