ToolTipsFactory

Object Model - Additional Methods and Functions - SetMultiLineToolTip

Assigns the passed MultiLineTTDatasource-object to the extended property provided to a specific control.

[Visual Basic]
<ExtenderProvidedProperty()> _ 
Public Sub SetMultiLineToolTip( _
		ByVal acontrol As Control, _ 
		ByVal ds As MultiLineTTDataSource)
[C#]
[ExtenderProvidedProperty()] 
public void SetMultiLineToolTip(
	Control acontrol,
	MultiLineTTDataSource ds
);

Parameters

acontrol

The target-control. The passed MultiLineTTDatasource-object is attached to the extended property provided to this control by the tooltip-component.

ds

The new MultiLineTTDatasource-object to attach to the extended property of acontrol.

Description

This method assigns the passed MultiLineTTDatasource-object (ds) to the extended property provided to the specified control (acontrol) by the MultiLineToolTip-component (ToolTipsFactoryMultiLine). It is this object which holds the tooltip-content (and some other properties) used for the tooltip to be displayed for acontrol.

In the Visual Studio property-grid the access to the MultiLineTTDatasource-object of a specific control is seamlessly integrated in the property-list of the specific control. (See the chapter on "Provided Properties" for more information.)

To assign a new or another instance of an MultiLineTTDatasource-object to the extended property of a specific control through code, things are not exactly as one would expect: The MultiLineTTDatasource-object is a property provided to a control by the tooltip component, and - if looking at the property-grid of the control - it definitely seems to be just a normal property of that control, but if you try to assign a new value to this property by code as to any other property of the control, you'll see that this is not possible, because the control does not expose such a property. Actually, the control, to which the tooltip-component provides this property, has absolutely no knowledge about this provided property, because this extended properties are managed by the providing component (in this case the MultiLineToolTip-component). Therefore the programmatic access to this properties has to happen through the providing component.  And that's where SetMultiLineToolTip() comes into play. SetMultiLineToolTip() tells the tooltip-component to set the passed MultiLineTTDatasource-object (ds) as new value for the property provided to the specified control (acontrol).

The following example shows how this could look in code:

 

'Create a new MultiLineTTDataSource

Dim myToolTipDS As MultiLineTTDataSource

myToolTipDS = New MultiLineTTDataSource

 

'We assign new content (help-text retrieved from

'database)

myToolTipDS.Text = GetHelpText("ChangeCartridge")

 

'And - because we know that this text could

'be quiet long - we have to make sure that the tooltip

'has an appropriate size. For this,

'we override the DefaultWidth defined by the

'tooltip-component with an adequate value...

myToolTipDS.Override.DefaultWidth = 320

'...and make sure, that wrapping occurs only on

'word-boundaries

myToolTipDS.Override.AutoSize = True

 

'Finally we can assign the new MultiLineTTDataSource-object

'to the extended property provided to lblChangeCartridge

Me.helpTT.SetMultiLineToolTip(Me.lblChangeCartridge, myToolTipDS)