Hello,
Here is how to open a dialog:
DialogLibraries.LoadLibrary("Standard")
myDlg = CreateUnoDialog(DialogLibraries.Standard.DIALOG_NAME)
myDlg.Execute()
myDlg.dispose()
However, the manner in which your question is presented seems to have nothing to do with dialogs at all.
If in fact the user is selecting a list box item ( appears to be a list of tables - how is it generated?) and you want to open a view of this table, a dialog is not the manner to accomplish this (although it can be done but more coding). If this is really the case, the probable way to do this is to create all the views (table grid control?) and forms for each table involved then hide/reveal the appropriate grid/form based upon the selection (have done similar using sections).
Don’t know what use this is for. Have not seen anyone request something like this. Maybe some insight as to the reason or why it is needed?
There are some links to samples in my answer here → base: how to make a form that relates to different possible tables
Edit 2018-06-01:
Yes, my explanation above still applies. However if you insist on using dialogs you have a lot of work ahead.
Dialogs are NOT data aware! You cannot access tables in the dialog - reading OR writing. All you have there is fields. You have to move data from and to tables using coding through macros (they are NOT Calc macros - just macros). You can access fields in a dialog before displaying the dialog - see my answer in this post → How to enter text into a dialog textbox via macro?. So that answers you current question.
Now for the user to enter data, you must have the dialog be a global variable; in your case that would be openDialog
. Now you openDialog.Execute
so the dialog is presented to the user. The user enters data and signifies completion by pressing a button on the dialog which triggers an event which triggers another macro written by you. This macro gets the info entered by the user from the field using the global variable and you must the update the appropriate field in the appropriate table. This continues until the dialog is closed.
A lot of work because code needs to be written for each and every table you are going to do this for. Also depending upon just what is being updated in each table you may need to have different dialogs for each table. You can get around this by coding your own dialog and placing appropriate fields in the dialog using a macro. For this see my sample in my question here → Looking to create grid (not table) control on Base form. There is another sample & code (basic & python) in my question here → Dialog problem when using Python.
Edit #2 2018-06-01:
Have put together a quick sample of hiding/revealing grids based on different tables depending upon list box selection.
Sample ----- MultiTableSelectionEntry.odb
Neither of the two methods are preferable. You should simply have a different form for each table you are attempting to modify.
If this answers your question please tick the (upper left area of answer). It helps others to know there was an accepted answer.