I have seen answers (all same) in similar questions here and here and here. But is there a “simple” way to pass a BASE table or any other recordset type (ex. from an SQL query) to the Grid “widget” mentioned there?
We can extract all records from a table or SQL query and append them as rows, but this will have performance penalties already resolved by the grid “widget” included in BASE forms. The grid in BASE forms does all the stuff by fetching more rows when the user scrolls down or by changing the rows when a filter is applied etc. etc. so there is no need to “reinvent the wheel”.
A simple filter can be applied in code by adding a text entry in the dialog with a “listener”.
The problem exists because (as far as I know) there is no way to create a modal form, from which the user can select a single value in a way more “friendly” than a dropdown list.
Slightly modifying Ratslinger’s GridDialog.odb example (from above mentioned link) I created a dialog that gets a selection ( DialogGridDemo3.odb).
But still this cannot be used to automatically receive data from recordset in a usable way such as creating a filter while the dialog runs for example by adding a checkbox that will filter results showing -or not- only latest year.
- The only distinction between the idea of “normal window” and a dialog is that dialogs wait (in code) for user interaction and may return a value based on user’s answer. Normal windows are just “presented” to user without “waiting” (in code).
- OpenOffice (thus I assume LibreOffice also) is based on MVC architectural design which means data awareness of the control depends on controller, not the control itself.
- There is definitely a LibreOffice service (simple or complicated, but I do not know which is) that implements the data awareness of the grid inside the Writer Documents that are used as “forms” (“form” a.k.a window, not “form” as the MainForm inside that Writer Document) in the .odb files. I am not sure if this service uses the same grid control (but I assume it is). If this is not the case, which is the service (and the accompanied control) that gets and presents the data in a grid in the Writer Documents that are used as .odb “forms”?
So the “final” question is: Is there a way to provide a “data provider” to such a grid embedded in a dialog?