I use advdbgrid (ver 2.8.3.3, Delphi 12.2) to display the content of a table and in a panel next to it I display the columns of the record selected. This panel has a button to open a OpenPictureDialog to get some png file. So I put the table in edit mode and as soon as I click the button to open the OpenPictureDialog the table exits the edit state and returns to browse state and not posting the data I changed.
I tried changing son properties like EditPostMode = epRow and somenavigation option like CursorWalkAlwaysEdit.
When I programmed this app several years ago, It didn't show this behavior, but some users reported this problem in new versions...
Any suggestion to fix this?
Francisco
It is by design that when the focus is moved away from the grid that the cell goes out of edit mode. If you need the table to be in edit mode when you call OpenPictureDialog, I suggest to do so programmatically before opening this dialog.
Thank you Bruno:
That's what I thought at first, but then I modified and compiled the demo for DBAdvGrid/ADOEditings, added two buttons: one for put the table in edit mode and the other to call OpenPictureDialog and it worked as I needed: table's Country field was modified with the picture file name... the table stays in edit mode.
I copied the DBAdvGrid component in the demo to my project keeping all properties, except, of course, the table properties and it didn't work. When I press the button to call the OpenPictureDialog both grids exit from edit mode to browse mode...
The difference is that my project connects to a MS SQL Server table using TDFQuery component. I lookup in the TFDConnection and in the TFDQuery but didn't find any properties to change...
Are the FD components to blame?
Francisco
I cannot think the FD components could cause this.
I do not fully understand what you try though. You say you have 2 buttons, one to put the dataset in edit mode , the other to start the OpenPictureDialog. I assume you do the exact same sequence in your project. I aslso assume that when you press the button to edit the dataset and then the button to call OpenPictureDialog, you do not give the grid focus?
That's correct...
I use the side panel to add and modify records, not the grid .
See the "Catálogo de Componentes", the third group of pictures in the page
The ribbon contains the edit button and on the right panel, next to "Ayuda Visual" are two buttons: one for the OpenPictureDialog (an open folder) and one to edit it once posted (a pallete).
In the meantime, I modified my project to to make it work while I (we?) find a solution.
Francisco
It would help if you could adapt one of our demos, like the ADOEditing demo and send it so we can reproduce it here, then we can investigate this deeper.
Hi Bruno:
The issue is not present in the demo, I already adapted it, as you suggest, and it works fine. I even copied the grid from your demo to my project (to preserve all properties) and it fails.
Only difference is that the demo uses ADOTable (MS Access) and my project FDQuery (SQL Server)...
Do you see this issue in a demo like FDMemTable?
Do you see it when you replace in the ADOEditing demo the dataset to a FDTable or FDQuery for example?
Hi Bruno
I copied all related components and properties from my project to demo project and it works as expected. The picture's filename is saved to the record in edit mode in both EditPostMode epCell and epRow, so the grid loosing focus doesn't affect the edit mode. That way my project was working many years ago.
My project source code is old, maybe there is a property left from an old version and still it's causing the record to exit edit mode when compiling with the newest version of the compiler and the components...
I modified my project to work around this behavior and later I'll investigate more.
Thank you for your support
Francisco