To create complex and interactive documents in Lotus Symphony, people find it necessary to build dialogs and macros with Lotus Symphony.
This article quickly shows how you can build your Dialog.
To build your dialog, open your document.
Click Tools then Macros then Macro
Click on Untitled then Sample
Click Organizer
Note: Untitled represents the name of your document.
Click New Dialog
Enter the name of the Dialog as MyDialog
Click Ok
Click Edit
You should see:
In the menu bar, you see a number of options.
Click on the drop down for the controls element
You should see the controls toolbar, and now you can add a button and a text box to MyDialog.
Now you should now write the supporting macro code
Right Click the Toolbar at the bottom
Click Insert, then BASIC Module
Now you can add the LaunchDialog code to the Module
This code locates the library it is stored in, and then grabs the MyDialog, and launches it.
Dim myDialog
Sub launchDialog
Dim oLib
Dim oLibDlg
DialogLibraries.loadLibrary("Standard")
oLib = DialogLibraries.getByName("Standard")
oLibDlg = oLib.getByName("MyDialog")
myDialog = CreateUnoDialog(oLibDlg)
myDialog.execute()
End Sub
The next step is to complete the code behind the Command Button.
The code inserts a simple string.
Sub insertIntoDoc
Dim oText
oText = myDialog.getControl("TextField1")
Dim oDocText
oDocText = ThisComponent.Text
oViewCursor = ThisComponent.getCurrentController().getViewCursor()
oCursor = oDocText.createTextCursorByRange(oViewCursor.getStart())
oDocText.insertString(oCursor,oText.Text,false)
End Sub
Now, you need to link the insertIntoDoc method to the Command Button.
Click on the MyDialog tab
Right Click the CommandButton
Click Properties
Click Events
Click the ellipsis next to When Initiating
Drill down in your document, click on the insertIntoDoc macro
Click Assign
Click Ok
You can now close the Basic Editor.
With the code complete, you can add a button to execute MyDialog.
Click View, then Toolbar, then Form Functions
Add a Push Button to the Page
Note: From the toolbar, you may need to enable Design Mode
Right Click on your new Button
Click Control Properties
Click Events
Click the ellipsis next to When Initiating
Drill down in your document, click on the launchDialog macro
Click Assign
Click Ok
Disable the Design Mode
Click the Toolbar Icon
Now Run your Dialog by Clicking the Button
You now have a form enabled Document.
References:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Basic/OpenOffice.org_Basic
Sample:
(See attached file: New Document.odt)