In Place Editing with Total Access Memo
Provided by: FMS Development Team
We’ve had many requests to allow end users of
Total Access Memo
to bold or italicize words without using our external FMS Rich Text Editor.
So, we are going to show a brief example of how to programmatically allow
users to do this.
First, you’ll want to have a Total Access Memo control on your form named “tamDemo”.
Next, add a single button named “cmdBold” to
the form.
Now, let’s open the IDE and write a little bit of code:
We are going to set a variable to the actual Total Access Memo Control
Object. By setting it to the Object, we will be using the Control's Object
properties and not the built in MS Access Object properties. For more
information on why you want to do it this way, see our previous
Tip #1: Finding Properties and Methods of an ActiveX Control.
Once we've set the variable, we will use the Total Access Memo Control
property named ".SelBold" to Bold the selected text.
' Bold the selected text in
the control by using the SelBold property. Private Sub
cmdBold_Click()
' Create a variable to
point to the Total Access Memo control Dim objFMSMemo As
FMSMemo
' Get a handle to the memo control
Set objFMSMemo = Me.tamDemo.Object
' Check to ensure some text is selected If
objFMSMemo.SelLength > 0 Then
If IsNull(objFMSMemo.SelBold) Then
' NULL indicates some
bold and some not bold text are selected.
' If so, set all selected Text to Bold
objFMSMemo.SelBold = True
Else
' Set it to the
opposite of what it currently is.
objFMSMemo.SelBold = Not objFMSMemo.SelBold End If
Else MsgBox "Please select some text", vbOKOnly, "FMS
TIP" End If End Sub
So, as you can see, the programmatic interface that our control has exposed
for you, allows you to programmatically manipulate the Bold property of the
text. You can also manipulate other properties such as Italics (SelItalic),
Underline (SelUnderline), and more. These are only a few examples of the
interface exposed for you to use. There are many more that you will find
just as useful and very easy to implement as well.
If you'd like to see how we implemented the properties, methods and events
available in the control, we invite you to download our Demo program that
shows how to use the program. All of the code we wrote that implements these
items is open for you to see how easy it is to write and utilize the code.
The Demo can be found at the following URL:
FMS Total Access Memo
(Demo)
Return to the tips page.
|