Custom class - SEtting rtstyle to bold

Hi all,

I am attempting to delve into object oriented coding in lotus script…I am building a group of classes to try and make creating, populating and sending a mail easier in, for instance, a scheduled agent.

Eventually I will include code to create and populate tables without having to mess around with the umpteen classes you currently have to. But at first, and because ia am a newbie at this, i am starting with some simple stuff… So I have a class called ‘TextEffect’ this class contains a method to set the style to bold…

Here is the code…

'set the style to bold and if append to the rich text item

Sub setStyleBold(argVal As Variant, setStyleToRtitem As Variant, textAppend As String)

	If argVal = True Or argVal = False Then

		tStyle.bold = argVal

	Else

		Error 9999, "The first argument in method SETSTYLEBOLD must be either true or false"

	End If

	

	If setStyleToRtitem = True Or setStyleToRtitem = False Then

		If setStyleToRtitem Then

			Call tRtitem.appendstyle(tStyle)

		End If

	Else

		Error 9999, "The second argument for method SETSTYLEBOLD must be either true or false"

	End If

	

	If textAppend <> "" Then

		tStyle.Bold = True

		Call tRtitem.appendstyle(tStyle)

		Call tRtitem.appendtext(textAppend)

		

		'take off bold

		tStyle.Bold = False

		Call tRtitem.appendstyle(tStyle)

	End If

End Sub

I am also learning java and i know in java you can setup more than one method of the same name, with different arguments. Well I want a method that will accept the following combination. setStyleBold(setStyle true or false, append to rtitem true or false).

I want another version of the same method which will do the following setStyleBold(text to append to rtitem in bold). I want this one to automatically set the style to bold, append the text and change the style back to whatever it was before.

I don’t seem to be able to create two methods of the same name, but with different numbers of arguments in lotusscript so the above code was my attempt. Could any of the wise gurus here have a butchers and give me some pointers? It would be very much appreciated.

Stephen

Norwich, England

Subject: Custom class - SEtting rtstyle to bold

Neither of the alternatives you’d need – method overloading or optional arguments with defaults – are available in LotusScript.

Subject: RE: Custom class - SEtting rtstyle to bold

Hi there,

How do i implement these?

Subject: RE: Custom class - SEtting rtstyle to bold

You don’t – you simply get used to passing an inconvenient argument, or ou use Java instead.