Hello everyone,
I am quite stymied as why the subject of this thread turns up sweet-blow-all in the search results on the internet, except perhaps that I, an experienced GW-Basic,Thoroughbred Basic and Visual Basic programmer, am not understanding about how to use “com.star.sun” statements. Oh, that’s totally possible, yes.
So I’m working with hints like
Sub J_FNFilePicker
‘ ==== THIS CODE WAS WRITTEN BY J. NIFENECKER
' ---- From his Ref Card document about dialog controls
Dim oFilePicker As Object
Dim FileName As String
FileName = ""
'FilePicker initialization
oFilePicker = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oFilePicker.DisplayDirectory = ConvertToURL("C:\Path\To\SomeDir")
oFilePicker.appendFilter("Calc Documents", "*.ods")
oFilePicker.CurrentFilter = "Calc Documents"
oFilePicker.Title = "Select a Calc document"
'execution and return check (OK?)
If oFilePicker.execute = _
com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then
FileName = oFilePicker.Files(0)
End If
End sub
And if there’s isn’t a list, I’m making one.
- I remember reading somewhere that they’re case-sensitive.
I started with the following list drawn from Nifenecker’s RefCard #6, and then I found code in Pitonyak’s document that produced a lo-o-o-ong list of com.sun.star.AlLSortsOfThings, which is, as yet, Martian to me.
SYNTAX: oFilePicker = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
' ==== CONTROLS
com.sun.star.ui.dialogs.FilePicker ' ---- File selection dialog
com.sun.star.ui.dialogs.OfficeFilePicker ' ---- Refined file selection dialog
com.sun.star.ui.dialogs.SystemFilePicker ' ---- Refined file selection dialog
com.sun.star.ui.dialogs.FolderPicker ' ---- Folder selection dialog
com.sun.star.ui.dialogs.OfficeFolderPicker ' ---- Refined folder selection dialog
com.sun.star.ui.dialogs.SystemFolderPicker ' ---- Refined folder selection dialog
' ====
com.sun.star.ui.dialogs.ExecutableDialogResults.OK ' ---- e.g. vbOkonly, vbYesNoCancel (a guess)
et cetera
I could really use all the help I can get. I’m new here, and I’m new to these forums (so I’m just waiting to flamed by a mod because I’m posting this in the wrong place – sorry!) and it’s a bit demotivating to have been through some topics and lot of replies are wishy-washy, with very few “Yay it worked!” responses. My favourite was in the lines of “Is there, like, a beginner manual?” (like for me who at least knows what Option Base 1 means), and the reply was “No, there isn’t.” And that was the end of that… So my hopes aren’t really up there.
I’m actually trying to write a UI for a spreadsheet payroll system that I wrote. (Note please that I am not looking for anyone to suggest using LO Base or available payroll systems to me, this is a personal “Learn LO Basic” project.) I’ve got as far as creating a number of dialogs with text boxes and checkboxes and things, and task #next is to populate them with spreadsheet information and click NEXT / PREVIOUS buttons to just LOOK at the information and, oh, my sweet baby Apollo, I feel as dumb as a withered plant…
I’ve got this, and it works! Yay! (I am aware that “Example:
” will never execute, it means nothing there.)
Sub frmAddEmployee_load()
Dim lLibrary
Dim fLibraryAddEmployeeForm 'Dialog as stored in the library
Dim frmReviewEmployee As Object
DialogLibraries.loadLibrary("Standard")
lLibrary = DialogLibraries.getByName("Standard")
fLibraryAddEmployeeForm = lLibrary.getByName("frmAddEmployee")
frmReviewEmployee = CreateUnoDialog(fLibraryAddEmployeeForm)
frmReviewEmployee.Execute()
Exit Sub
Example:
' Set my combo box for properties, methods, and services
aControl = oDlg.getControl("myComboBox")
aControl.addItems(Array("properties", "methods", "services"), 0)
aControl.setText("properties")
End Sub
Then in the next routine, 4th last line, I’m cycling through my myriad controls to enabe this, hide that, first up, checkbox. Presumably I have to declare UNO variable of type checkbox, make my checkbox an instance of said UNO variable, declare each property thereof that I want to prod, with sun.com.star.beans and make my checkbox’s properties instances of said property, because what I’m trying below isn’t working and I’m stuck. I don’t know what else to do.
Sub frmJJPayroll_load()
' Sub frmAddEmployee_Load()
' Dim WidgetX 'As What?
' WidgetX = frmPayroll.getControl("fraButtons")
' Print "lol " & widgetx.DBG_properties
' WidgetX.label = ""
'End Sub
REM Declare the primary variables
Dim lLibrary
Dim fLibraryJJPayrollForm 'Dialog as stored in the library
Dim frmPayroll As Object
Dim WidgetX
Dim empStatic As EmployeeStaticRecord ' ---- user-defind type, Name as String, Surname as String, bla bla bla
REM Load the library and the dialog
DialogLibraries.loadLibrary("Standard")
lLibrary = DialogLibraries.getByName("Standard")
fLibraryJJPayrollForm = lLibrary.getByName("frmJJPayroll")
frmPayroll = CreateUnoDialog(fLibraryJJPayrollForm)
frmpayroll.getmodel.title= "Welcome to " & APP_NAME & "!"
' ---- Fix the checkbox
WidgetX = frmPayroll.getcontrol("chkAutoNumber")
Print WidgetX.DBG_properties
frmPayroll.Execute()
End Sub
I need a list like the above that I expect to see entries like the following on it. I NEED that LIST!
com.sun.star.TextField ‘ ---- I haven’t tried this but I presume it exists
com.sun.star.LabelField ‘ ---- now I’m sucking things out of my thumb
com.sun.star.TickBox
com.sun.star.Listbox
com.sun.star.VerticalScrollBar
Then, there’s this “com.sun.star.beans” thing…
It LOOKS like I can create properties of any name whatsoever, and I am not grasping from the handful of examples I have at my disposal how Basic knows which control I’m creating properties for. I’ve got
PropertyX(0).Name as “Age”, PropertyX(0).Value as 27,
and PropertyX(1).Name as “Weight” and PropertyX(1).Value as 97,
and PropertyX(2).Name as “FavouriteMilkshakeFlavour” and PropertyX(2).Value as “Butterscotch”
But they don’t seem to be properties OF anything and I just. Don’t. Get it.
Anyone feel like suffering a fool?
Thanks