ToolTipsFactory

Object Model - Additional Methods and Functions - SetSingleLineToolTip

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

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

Parameters

acontrol

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

ds

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

Description

This method assigns the passed SingleLineTTDatasource-object (ds) to the extended property provided to the specified control (acontrol) by the SingleLineToolTip-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 SingleLineTTDatasource-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 SingleLineTTDatasource-object to the extended property of a specific control through code, things are not exactly as one would expect: The SingleLineTTDatasource-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 SingleLineToolTip-component). Therefore the programmatic access to this properties has to happen through the providing component.  And that's where SetSingleLineToolTip() comes into play. SetSingleLineToolTip() tells the tooltip-component to set the passed SingleLineTTDatasource-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 SingleLineTTDataSource

Dim myToolTipDS As SingleLineTTDataSource

myToolTipDS = New SingleLineTTDataSource

 

'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

'AutoSize-value defined by the tooltip-component and

'set it True. This makes sure that the width of the

'tooltip is adapted as much as possible....

myToolTipDS.Override.AutoSize = True

 

'Finally we can assign the new SingleLineTTDataSource-object

'to the extended property provided to lblChangeCartridge

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