Hello,
Please keep to single questions. Multiple get buried from others looking for answers.
Also note that you are basing information on an almost 4 year old question (not an answer). This question was actually asked to have the grid available in a form (not possible to my knowledge). This code was strictly a bunch of code doing a variety of tests and not necessarily all productive. There is a lot of digging just to understand the basics of constructing a grid control.
Your questions:
1.Two dialogs poped up, only the latest one must be active.
Is it possible to alter the previously
opened dialog to be active ?
First, if you want the other dialog to be active just click on the header of the dialog. If you did not want to have both opened, close one with code before opening the other. With code set the dialogs as global and end the execution of what is not wanted.
And how is it know which one was previously opened? In this cas you talk of two. What if there were more? What if they were reversed? Need logic to determine what is what.
2.If only ‘Budget System - Average Expenses’ is active, I need to double
click on grid row number 2 in order to
get the content of first cell,
‘Utilities’, to be placed in Calc cell
B6.
Is there double click event for grid
and sample codes?
Here is what is available → com::sun::awt::grid Module Reference
There is nothing for a double click. There is a selection listener. Here is a post incorporating that → Libre Office custom Dialog Table
Edit
Attaching a sample. The first dialog (original) has a key handler attached. When a row is selected & Enter
key is used the row with first column entry is displayed. This would be used for your entry to the sheet.
The second dialog uses a mouse handler. Found a method for double click. So a double click on a row will display the data.
Sample (Revised mouse double click) ---- DialogsOrig.ods
End Edit
3.I have adapted BASIC codes from Base to use in Calc BASIC of
C:\fakepath\0006.ods.
Library1 > Module1Original >
AvgExpenseDialog
In Calc BASIC line 138,
oDialogModel.Title = “GridControl
Test” does not show in dialog.
What is this line used for ?
As stated in the beginning, this was a lot of testing. oDialogModel
was part of the tests. Nothing shows for this as the actual was based upon oDlgModel
.
Edit 2020-02-23:
It appears, based on questions elsewhere, you may not have a handle on listeners. Here is another sample. It contains two menu selections (your insertion). The first uses Account code grid. A double mouse click will insert the code into the selected cell on the sheet. The second selection uses the Item grid. Any selection here will enter the item into the selected cell on your sheet. NOTE: If you use a Print
or MsgBox
in the selectChange
function your system will freeze and a reboot is needed (this is my experience).
Sample ------- GridSelection.ods