%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/lib/libreoffice/share/basic/SFWidgets/
Upload File :
Create Path :
Current File : //proc/self/root/lib/libreoffice/share/basic/SFWidgets/SF_ToolbarButton.xba

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="SF_ToolbarButton" script:language="StarBasic" script:moduleType="normal">REM =======================================================================================================================
REM ===			The ScriptForge library and its associated libraries are part of the LibreOffice project.				===
REM	===						The SFWidgets library is one of the associated libraries.									===
REM ===					Full documentation is available on https://help.libreoffice.org/								===
REM =======================================================================================================================

Option Compatible
Option ClassModule

Option Explicit

&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;&apos;
&apos;&apos;&apos;	SF_ToolbarButton
&apos;&apos;&apos;	================
&apos;&apos;&apos;		Hide/show toolbar elements, read and update their current behaviour..
&apos;&apos;&apos;
&apos;&apos;&apos;		A toolbar consists in a series of graphical controls to trigger actions.
&apos;&apos;&apos;		The &quot;Toolbar&quot; service gives access to the &quot;ToolbarButton&quot; service to manage
&apos;&apos;&apos;		the individual buttons belonging to the toolbar.
&apos;&apos;&apos;
&apos;&apos;&apos;		Changes made by scripts to buttons belonging to toolbars stored in the application
&apos;&apos;&apos;		are persistent. They are valid for all documents of the same type.
&apos;&apos;&apos;
&apos;&apos;&apos;		The name of a toolbar button is either:
&apos;&apos;&apos;			- in custom toolbars, a predefined name given at its creation,
&apos;&apos;&apos;			- in standard toolbars, a localized name as read in the Tools + Customize ... dialog box
&apos;&apos;&apos;
&apos;&apos;&apos;		Service invocation:
&apos;&apos;&apos;			It is available only from an active Toolbar service.
&apos;&apos;&apos;			Example:
&apos;&apos;&apos;				Dim oCalc As Object, oToolbar As Object, oToolbarButton As Object
&apos;&apos;&apos;				Set oCalc = CreateScriptService(&quot;Calc&quot;, &quot;myFile.ods&quot;)
&apos;&apos;&apos;				Set oToolbar = oCalc.Toolbars(&quot;findbar&quot;)
&apos;&apos;&apos;				Set oToolbarButton = oToolbar.ToolbarButtons(&quot;Find Next&quot;)

REM ================================================================== EXCEPTIONS

REM ============================================================= PRIVATE MEMBERS

Private [Me]					As Object
Private ObjectType				As String		&apos; Must be TOOLBARBUTTON
Private ServiceName 			As String
Private [_Parent]				As Object		&apos; SF_Toolbar instance owning the button

Private _Index					As Long			&apos; Entry number in buttons lists
Private _Label					As String		&apos; Label (static description)
Private _AccessibleName			As String		&apos; Name found in accessible context
Private _Element				As Object		&apos; com.sun.star.ui.XUIElement

Private _CommandURL				As String		&apos; Uno command or script

Private _Height					As Long			&apos; Height may be cached
Private _Width					As Long			&apos; Width may be cached

REM ============================================================ MODULE CONSTANTS

REM ====================================================== CONSTRUCTOR/DESTRUCTOR

REM -----------------------------------------------------------------------------
Private Sub Class_Initialize()
	Set [Me] = Nothing
	ObjectType = &quot;TOOLBARBUTTON&quot;
	ServiceName = &quot;SFWidgets.ToolbarButton&quot;
	Set [_Parent] = Nothing
	_Index = -1
	_Label = &quot;&quot;
	_AccessibleName = &quot;&quot;
	Set _Element = Nothing
	_CommandURL = &quot;&quot;
	_Height = 0
	_Width = 0
End Sub		&apos;	SFWidgets.SF_ToolbarButton Constructor

REM -----------------------------------------------------------------------------
Private Sub Class_Terminate()
	Call Class_Initialize()
End Sub		&apos;	SFWidgets.SF_ToolbarButton Destructor

REM -----------------------------------------------------------------------------
Public Function Dispose() As Variant
	Call Class_Terminate()
	Set Dispose = Nothing
End Function	&apos;	SFWidgets.SF_ToolbarButton Explicit Destructor

REM ================================================================== PROPERTIES

REM -----------------------------------------------------------------------------
Property Get Caption() As String
&apos;&apos;&apos;	Returns the name of the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Caption

	Caption = _PropertyGet(&quot;Caption&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Caption (get)

REM -----------------------------------------------------------------------------
Property Get Height() As Long
&apos;&apos;&apos;	Returns the height in pixels of the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Height

	Height = _PropertyGet(&quot;Height&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Height (get)

REM -----------------------------------------------------------------------------
Property Get Index() As Long
&apos;&apos;&apos;	Returns the index of the button
&apos;&apos;&apos;		- in the Settings (com.sun.star.container.XIndexAccess) of the parent toolbar
&apos;&apos;&apos;		- in the AccessibleContext (com.sun.star.comp.toolkit.AccessibleToolBox) of the parent toolbar
&apos;&apos;&apos;	Both should be identical: the range number of the button in the toolbar, hidden buttons and separators included.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Index

	Index = _PropertyGet(&quot;Index&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Index (get)

REM -----------------------------------------------------------------------------
Property Get OnClick() As Variant
&apos;&apos;&apos;	Returns the UNO command or the script (expressed in the scripting framework_URI notation) run when the button is clicked
&apos;&apos;&apos;	Read https://wiki.documentfoundation.org/Documentation/DevGuide/Scripting_Framework#Scripting_Framework_URI_Specification
&apos;&apos;&apos;	Note that no event object is passed to the script.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.OnClick

	OnClick = _PropertyGet(&quot;OnClick&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.OnClick (get)

REM -----------------------------------------------------------------------------
Property Let OnClick(ByVal pvOnClick As Variant)
&apos;&apos;&apos;	Sets the UNO command or the script (expressed in the scripting framework_URI notation) to trigger when the button is clicked
&apos;&apos;&apos;	It is highly recommended to not modify standard buttons.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		myButton.OnClick = &quot;.uno:About&quot;
&apos;&apos;&apos;		myButton.OnClick = &quot;vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&amp;location=application&quot;

	_PropertySet(&quot;OnClick&quot;, pvOnClick)

End Property	&apos;	SFWidgets.SF_ToolbarButton.OnClick (let)

REM -----------------------------------------------------------------------------
Property Get Parent() As Object
&apos;&apos;&apos;	Returns the parent toolbar as a SF_Toolbar object instance
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		Set oToolbar = myButton.Parent

	Set Parent = _PropertyGet(&quot;Parent&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Parent (get)

REM -----------------------------------------------------------------------------
Property Get TipText() As Variant
&apos;&apos;&apos;	Specifies the text that appears in a screentip when you hold the mouse pointer over the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.TipText

	TipText = _PropertyGet(&quot;TipText&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.TipText (get)

REM -----------------------------------------------------------------------------
Property Let TipText(ByVal pvTipText As Variant)
&apos;&apos;&apos;	Sets the screentip associated with the actual toolbar button
&apos;&apos;&apos;	It is highly recommended to not modify standard buttons.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		myButton.TipText = &quot;Click here&quot;

	_PropertySet(&quot;TipText&quot;, pvTipText)

End Property	&apos;	SFWidgets.SF_ToolbarButton.TipText (let)

REM -----------------------------------------------------------------------------
Property Get Visible() As Variant
&apos;&apos;&apos;	Returns True when the toolbar button is visible. Otherwise False.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Visible

	Visible = _PropertyGet(&quot;Visible&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Visible (get)

REM -----------------------------------------------------------------------------
Property Let Visible(ByVal pvVisible As Variant)
&apos;&apos;&apos;	Sets the visible status of the toolbar button.
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		myButton.Visible = True

	_PropertySet(&quot;Visible&quot;, pvVisible)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Visible (let)

REM -----------------------------------------------------------------------------
Property Get Width() As Long
&apos;&apos;&apos;	Returns the width in pixels of the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Width

	Width = _PropertyGet(&quot;Width&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Width (get)

REM -----------------------------------------------------------------------------
Property Get X() As Long
&apos;&apos;&apos;	Returns the X (horizontal) coordinate in pixels of the top-left corner of the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.X

	X = _PropertyGet(&quot;X&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.X (get)

REM -----------------------------------------------------------------------------
Property Get Y() As Long
&apos;&apos;&apos;	Returns the Y (vertical) coordinate in pixels of the top-left corner of the button
&apos;&apos;&apos;	Example:
&apos;&apos;&apos;		MsgBox myButton.Y

	Y = _PropertyGet(&quot;Y&quot;)

End Property	&apos;	SFWidgets.SF_ToolbarButton.Y (get)

REM ===================================================================== METHODS

REM -----------------------------------------------------------------------------
Public Function Execute() As Variant
&apos;&apos;&apos;	Execute the command stored in the toolbar button.
&apos;&apos;&apos;	The command can be a UNO command or a Basic/Python script (expressed in the scripting framework_URI notation)
&apos;&apos;&apos;	Read https://wiki.documentfoundation.org/Documentation/DevGuide/Scripting_Framework#Scripting_Framework_URI_Specification
&apos;&apos;&apos;	No argument is passed to the script to execute.
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		The output of the script or Null
&apos;&apos;&apos;	Examples:
&apos;&apos;&apos;		result = myButton.Execute()

Dim vResult As Variant				&apos;	Return value
Dim sCommand As String				&apos;	Command associated with button
Dim oFrame As Object				&apos;	com.sun.star.comp.framework.Frame
Dim oDispatcher As Object			&apos;	com.sun.star.frame.DispatchHelper
Dim vScript As Variant				&apos;	Split command in script/argument
Dim oSession As Object				:	Set oSession = ScriptForge.SF_Services.CreateScriptService(&quot;ScriptForge.Session&quot;)
Dim oArgs() As new com.sun.star.beans.PropertyValue
Const cstUnoPrefix					= &quot;.uno:&quot;

Const cstThisSub = &quot;SFWidgets.ToolbarButton.Execute&quot;
Const cstSubArgs = &quot;&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	vResult = Null

Check:
	ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)

Try:
	sCommand = GetProperty(&quot;OnClick&quot;)
	If Len(sCommand) &gt; 0 Then
		&apos;	A button has been clicked necessarily in the current window (Document) or one of its subcomponents (FormDocument)
		Set oFrame = StarDesktop.ActiveFrame
		If oFrame.Frames.Count &gt; 0 Then Set oFrame = oFrame.getActiveFrame()
		&apos;	Command or script ?
		If ScriptForge.SF_String.StartsWith(sCommand, cstUnoPrefix) Then
			&apos;	Execute uno command
			Set oDispatcher = ScriptForge.SF_Utils._GetUNOService(&quot;DispatchHelper&quot;)
			oDispatcher.executeDispatch(oFrame, sCommand, &quot;&quot;, 0, oArgs())
			oFrame.activate()
		Else
			&apos;	Execute script
			vResult = oSession._ExecuteScript(sCommand)
		End If
	End If

Finally:
	Execute = vResult
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFWidgets.SF_ToolbarButton.Execute

REM -----------------------------------------------------------------------------
Public Function GetProperty(Optional ByVal PropertyName As Variant) As Variant
&apos;&apos;&apos;	Return the actual value of the given property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		PropertyName: the name of the property as a string
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		The actual value of the property
&apos;&apos;&apos;		If the property does not exist, returns Null
&apos;&apos;&apos;	Exceptions:
&apos;&apos;&apos;		see the exceptions of the individual properties
&apos;&apos;&apos;	Examples:
&apos;&apos;&apos;		myToolbar.GetProperty(&quot;Visible&quot;)

Const cstThisSub = &quot;SFWidgets.ToolbarButton.GetProperty&quot;
Const cstSubArgs = &quot;&quot;

	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	GetProperty = Null

Check:
	If ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not ScriptForge.SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
	End If

Try:
	GetProperty = _PropertyGet(PropertyName)

Finally:
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFWidgets.SF_ToolbarButton.GetProperty

REM -----------------------------------------------------------------------------
Public Function Methods() As Variant
&apos;&apos;&apos;	Return the list of public methods of the Model service as an array

	Methods = Array( _
					&quot;Execute&quot; _
					)

End Function	&apos;	SFWidgets.SF_ToolbarButton.Methods

REM -----------------------------------------------------------------------------
Public Function Properties() As Variant
&apos;&apos;&apos;	Return the list or properties of the Timer a.AddItem(&quot;B&gt;B1&quot;)class as an array

	Properties = Array( _
					&quot;Caption&quot; _
					, &quot;Height&quot; _
					, &quot;Index&quot; _
					, &quot;OnClick&quot; _
					, &quot;Parent&quot; _
					, &quot;TipText&quot; _
					, &quot;Visible&quot; _
					, &quot;Width&quot; _
					, &quot;X&quot; _
					, &quot;Y&quot; _
					)

End Function	&apos;	SFWidgets.SF_ToolbarButton.Properties

REM -----------------------------------------------------------------------------
Public Function SetProperty(Optional ByVal PropertyName As Variant _
								, Optional ByRef Value As Variant _
								) As Boolean
&apos;&apos;&apos;	Set a new value to the given property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		PropertyName: the name of the property as a string
&apos;&apos;&apos;		Value: its new value
&apos;&apos;&apos;	Exceptions
&apos;&apos;&apos;		ARGUMENTERROR		The property does not exist

Const cstThisSub = &quot;SFWidgets.ToolbarButton.SetProperty&quot;
Const cstSubArgs = &quot;PropertyName, Value&quot;

	If SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	SetProperty = False

Check:
	If SF_Utils._EnterFunction(cstThisSub, cstSubArgs) Then
		If Not SF_Utils._Validate(PropertyName, &quot;PropertyName&quot;, V_STRING, Properties()) Then GoTo Catch
	End If

Try:
	SetProperty = _PropertySet(PropertyName, Value)

Finally:
	SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFWidgets.SF_ToolbarButton.SetProperty

REM =========================================================== PRIVATE FUNCTIONS

REM -----------------------------------------------------------------------------
Private Function _GetPosition() As Object
&apos;&apos;&apos;	Determine the position of the top-left corner of the actual button.
&apos;&apos;&apos;	Returns:
&apos;&apos;&apos;		a com.sun.star.awt.Rectangle structure

Dim oElement As Object						&apos;	com.sun.star.ui.XUIElement
Dim oAccessible As Object					&apos;	com.sun.star.comp.toolkit.AccessibleToolBoxItem
Dim oAccessibleButton As Object				&apos;	com.sun.star.comp.toolkit.AccessibleToolBoxItem
Dim oAccessibleParent As Object				&apos;	com.sun.star.comp.toolkit.AccessibleToolBoxItem
Dim oRect As Object							&apos;	Return value As com.sun.star.awt.Rectangle

Try:
	Set oElement = _Element.GetSettings(True).getByIndex(_Index)
	Set oRect = CreateUnoStruct(&quot;com.sun.star.awt.Rectangle&quot;)
	If ScriptForge.SF_Utils._GetPropertyValue(oElement, &quot;IsVisible&quot;) Then
		Set oAccessible = _Element.getRealInterface().getAccessibleContext()	&apos;	Toolbar level
		Set oAccessibleParent = oAccessible.getAccessibleParent()				&apos;	Window level
		Set oAccessibleButton = oAccessible.getAccessibleChild(_Index)			&apos;	Toolbar button level
		&apos;	The X and Y coordinates are always computed correctly when the toolbar is docked.
		&apos;	When the toolbar is floating, the Y ordinate may be overestimated with the height of
		&apos;	the tabbed bar or similar. However no mean has been found to get that height via code.
		With oRect
			.X = oAccessible.Location.X + oAccessibleButton.Location.X + oAccessibleParent.PosSize.X
			.Y = oAccessible.Location.Y + oAccessibleButton.Location.Y + oAccessibleParent.PosSize.Y
			.Height = oAccessibleButton.Size.Height
			.Width = oAccessibleButton.Size.Width
		End With
	Else
		With oRect
			.X = -1	:	.Y = -1	:	.Height = 0	:	.Width = 0
		End With
	End If

Finally:
	Set _GetPosition = oRect
	Exit Function
End Function	&apos;	SFWidgets.SF_ToolbarButton._GetPosition

REM -----------------------------------------------------------------------------
Public Sub _Initialize(ByRef poToolbarButton As Object)
&apos;&apos;&apos;	Complete the object creation process:
&apos;&apos;&apos;		- Initialize the toolbar descriptioner use
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		poToolbarButton: the toolbar description as a ui._Toolbr object

Try:
	&apos;	Store the static description
	With poToolbarButton
		Set [_Parent] = .Toolbar
		_Index = .Index
		_Label = .Label
		_AccessibleName = .AccessibleName
		Set _Element = .Element
	End With

	&apos;	Complement
	_CommandURL = ScriptForge.SF_Utils._GetPropertyValue(_Element.getSettings(True).getByIndex(_Index), &quot;CommandURL&quot;)

Finally:
	Exit Sub
End Sub			&apos;	SFWidgets.SF_ToolbarButton._Initialize

REM -----------------------------------------------------------------------------
Private Function _PropertyGet(Optional ByVal psProperty As String) As Variant
&apos;&apos;&apos;	Return the value of the named property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		psProperty: the name of the property

Dim vGet As Variant							&apos;	Return value
Dim sTooltip As String						&apos;	ToolTip text
Dim oElement As Object						&apos;	com.sun.star.ui.XUIElement
Dim cstThisSub As String
Const cstSubArgs = &quot;&quot;

	cstThisSub = &quot;SFWidgets.ToolbarButton.get&quot; &amp; psProperty
	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch

	ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)
	_PropertyGet = Null

	Select Case UCase(psProperty)
		Case UCase(&quot;Caption&quot;)
			_PropertyGet = Iif(Len(_Label) &gt; 0, _Label, _AccessibleName)
		Case UCase(&quot;Height&quot;)
			If _Height &gt; 0 Then _PropertyGet = _Height else _PropertyGet = _GetPosition().Height
		Case UCase(&quot;Index&quot;)
			_PropertyGet = _Index
		Case UCase(&quot;OnClick&quot;)
			Set oElement = _Element.GetSettings(True).getByIndex(_Index)
			_PropertyGet = ScriptForge.SF_Utils._GetPropertyValue(oElement, &quot;CommandURL&quot;)
		Case UCase(&quot;Parent&quot;)
			Set _PropertyGet = [_Parent]
		Case UCase(&quot;TipText&quot;)
			Set oElement = _Element.GetSettings(True).getByIndex(_Index)
			sTooltip = ScriptForge.SF_Utils._GetPropertyValue(oElement, &quot;Tooltip&quot;)
			If Len(sTooltip) &gt; 0 Then _PropertyGet = sTooltip Else _PropertyGet = Iif(Len(_Label) &gt; 0, _Label, _AccessibleName)
		Case UCase(&quot;Visible&quot;)
			Set oElement = _Element.GetSettings(True).getByIndex(_Index)
			_PropertyGet = ScriptForge.SF_Utils._GetPropertyValue(oElement, &quot;IsVisible&quot;)
		Case UCase(&quot;Width&quot;)
			If _Width &gt; 0 Then _PropertyGet = _Width else _PropertyGet = _GetPosition().Width
		Case UCase(&quot;X&quot;)
			_PropertyGet = _GetPosition().X
		Case UCase(&quot;Y&quot;)
			_PropertyGet = _GetPosition().Y
		Case Else
			_PropertyGet = Null
	End Select

Finally:
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	GoTo Finally
End Function	&apos;	SFWidgets.SF_ToolbarButton._PropertyGet

REM -----------------------------------------------------------------------------
Private Function _PropertySet(Optional ByVal psProperty As String _
								, Optional ByVal pvValue As Variant _
								) As Boolean
&apos;&apos;&apos;	Set the new value of the named property
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;		psProperty: the name of the property
&apos;&apos;&apos;		pvValue: the new value of the given property

Dim bSet As Boolean							&apos;	Return value
Dim oSettings As Object						&apos;	com.sun.star.container.XIndexAccess
Dim vProperties As Variant					&apos;	Array of PropertyValues
Dim bVisible As Boolean						&apos;	Actual Visible state

Dim cstThisSub As String
Const cstSubArgs = &quot;Value&quot;

Check:
	If ScriptForge.SF_Utils._ErrorHandling() Then On Local Error GoTo Catch
	bSet = False

	cstThisSub = &quot;SFWidgets.ToolbarButton.set&quot; &amp; psProperty
	ScriptForge.SF_Utils._EnterFunction(cstThisSub, cstSubArgs)

Try:
	bSet = True
	Set oSettings = _Element.getSettings(True)
	vProperties = oSettings.getByIndex(_Index)

	Select Case UCase(psProperty)
		Case UCase(&quot;OnClick&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Catch
			ScriptForge.SF_Utils._SetPropertyValue(vProperties, &quot;CommandURL&quot;, pvValue)
		Case UCase(&quot;TipText&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, V_STRING) Then GoTo Catch
			ScriptForge.SF_Utils._SetPropertyValue(vProperties, &quot;Tooltip&quot;, pvValue)
		Case UCase(&quot;Visible&quot;)
			If Not ScriptForge.SF_Utils._Validate(pvValue, &quot;Value&quot;, ScriptForge.V_BOOLEAN) Then GoTo Catch
			ScriptForge.SF_Utils._SetPropertyValue(vProperties, &quot;IsVisible&quot;, pvValue)
		Case Else
			bSet = False
	End Select

	oSettings.replaceByIndex(_Index, vProperties)
	_Element.setSettings(oSettings)

Finally:
	_PropertySet = bSet
	ScriptForge.SF_Utils._ExitFunction(cstThisSub)
	Exit Function
Catch:
	bSet = False
	GoTo Finally
End Function	&apos;	SFWidgets.SF_ToolbarButton._PropertySet

REM -----------------------------------------------------------------------------
Private Function _Repr() As String
&apos;&apos;&apos;	Convert the SF_ToolbarButton instance to a readable string, typically for debugging purposes (DebugPrint ...)
&apos;&apos;&apos;	Args:
&apos;&apos;&apos;	Return:
&apos;&apos;&apos;		&quot;[Toolbar]: Name, Type (dialogname)
	_Repr = &quot;[ToolbarButton]: &quot; &amp; Iif(Len(_Label) &gt; 0, _Label, _AccessibleName) &amp; &quot; - &quot; &amp; _CommandURL

End Function	&apos;	SFWidgets.SF_ToolbarButton._Repr

REM ============================================ END OF SFWIDGETS.SF_TOOLBARBUTTON
</script:module>

Zerion Mini Shell 1.0