Questo il codice
Codice: Seleziona tutto
Dim Dlg as object
Sub Tasto_Premuto (Event As Object)
if instr("1234567890",Event.KeyChar) > 0 then
dlg.getControl("TextField1").text = left(dlg.getControl("TextField1").text,len(dlg.getControl("TextField1").text)-1)
end if
End Sub
Sub ApriDialog
Dlg = LoadDialog("Standard","Dialog1")
dlg.getControl("TextField1").setfocus()
Dlg.execute()
End Sub
Function LoadDialog(Libname as String, DialogName as String, Optional oLibContainer)
Dim oLib as Object
Dim oLibDialog as Object
Dim oRuntimeDialog as Object
If IsMissing(oLibContainer ) then
oLibContainer = DialogLibraries
End If
oLibContainer.LoadLibrary(LibName)
oLib = oLibContainer.GetByName(Libname)
oLibDialog = oLib.GetByName(DialogName)
oRuntimeDialog = CreateUnoDialog(oLibDialog)
LoadDialog() = oRuntimeDialog
End Function
Private Sub DlgClose ' CHIUSURA RIQUADRO DI DIALOGO
dlg.endExecute() ' ESEGUE LA FUNZIONE DI CHIUSURA
End sub ' FINE
Private Sub cmdWriteCell
dim Cognome as String ' Var. testo
Cognome = dlg.getControl("TextField1").text ' LEGGO IL VALORE INSERITO DALL'UTENTE
Sheet = ThisComponent.Sheets(0)
c = Sheet.createCursor
c.gotoEndOfUsedArea(false)
LastRow = c.RangeAddress.EndRow + 2
Sheet.getCellRangeByName("A" & LastRow).String = Cognome
dlg.getControl("TextField1").text = ""
dlg.getControl("TextField1").setfocus()
End sub