Hello everybody
Sorry for my english which is translated by google translate
I answer my question with another account. I can no longer log in with Loki 6659.
There are many ways to add events to a combo box.
In the example below I add the Status changed event to the CmbxSearch combo box
In design mode:
-
right click on the combo box;
-
select Control properties;
-
from the events tab select Status changed;
-
choose the macro.
Write a macro that does something.
Example:
Search in column B for the item selected in the combo box:
'FIND THE ITEM SELECTED FROM THE COMBO BOX
sub Search_Name
Dim oSheet, oForm, oRange, oCmbxSearch, oDocument, oDispatcher, oCell as Object
Dim oConv as object
Dim sSearch as string
Dim iRow, jColumns as Integer
'OSheet = the active page
oSheet = ThisComponent.CurrentController.ActiveSheet
'oForm = the form of the “Form” sheet
oForm = oSheet.getDrawPage().getForms().getByName(“Form”)
oRange = oSheet.getCellRangebyName(“B10:B50”)
’ oCmbxSearch = CmbxSearch
oCmbxSearch = oSheet.DrawPage.Forms.GetByName(“Form”).GetByName(“CmbxSearch”)
oDocument = ThisComponent.CurrentController.Frame
oDispatcher = createUnoService(“com.sun.star.frame.DispatchHelper”)
sSearch = oCmbxSearch.text
jColumns = oRange.Columns.getCount() - 1
'cycles from cell B10 to cell B50
For iRow = 0 To oRange.Rows.getCount() - 1
oCell = oRange.getCellByPosition(jColumns, iRow)
If oCell.String = sSearch Then
oConv = ThisComponent.createInstance(“com.sun.star.table.CellAddressConversion”)
oConv.Address = oCell.getCellAddress
sSearch = oConv.UserInterfaceRepresentation
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = “ToPoint”
args2(0).Value = sSearch
oDispatcher.executeDispatch(oDocument, “.uno:GoToCell”, “”, 0, args2())
exit for
end if
Next
end sub
I don’t know how to attach the calc file with macros, it would have been useful