Macro base,write new value in "tab control"

Hello I’m using a “tab control” connected with a table, I can read accurately, the data stored
using this code:

child_form_container=ThisDatabaseDocument.FormDocuments.getByName(“frmDoc”)
oform=child_form_container.Component.getDrawPage().getForms().getByIndex(0)
oGrid=oform.tabDocuments ’ name of object
oColumnList=oGrid.getByIndex (0)

msgbox oColumnList.getCurrentValue() 'the msgbox return the selected value.

Now I need to insert a new value by macro, and I need a method, that let me to go
in the new row, and write there, a new value contained in a “File selection” or “text box” objects.

something like:

oColumnList.NewRecord()

oColumnList.setValue(‘value to write’)

I printed the relative methods e properties lists with .dbg_properties and dbg_methods
but, I did not find something good,
have you any ideas?

Thanks in advance

Hello,

I will guess that you are dealing with a table control as I don’t recall any “tab control”.

You can go to a new record (control doesn’t matter) with:

  Dim oForm As Object
  oForm = ThisComponent.DrawPage.Forms.getByName("YOUR_INTERNAL_FORM_NAME")
  oForm.moveToInsertRow()

You can get the various columns with:

 Dim oMyField As Object
 oMyField = oForm.getColumns().getByName("YOUR_FIELD_NAME")

and update (here a text field) the field data (data retrieved from where you require):

 oMyField.updateString("TEXT TO UPDATE")

You can save the record with:

Dim oDocument As Object
Dim oDispatcher As Object
oDocument   = ThisComponent.CurrentController.Frame
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDispatcher.executeDispatch(oDocument, ".uno:RecSave", "", 0, Array())

Of course fields and updating depend upon types and requirements set on your end.

Hello, I was talking about “table control”,
i found this solution:

oselPath= oform.selPath ' file selection control

oGrid=oform.tabDocuments  'table control

oColumnList=oGrid.getByIndex (0)

oColumnList.text=oselPath.Text

With this source, I can put the value in the “file selection control”, in the selected row in the “table control”.

Thanks