Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

OptimalPosition Method, SftMask Object

Updates the caret location and makes it optimal.

Syntax

VB.NETobject.OptimalPosition(ByVal GoingRight As Boolean)
VBobject.OptimalPosition(ByVal GoingRight As Boolean)
C#.NETvoid object.OptimalPosition(bool GoingRight);
VC++HRESULT object->OptimalPosition(VARIANT_BOOL GoingRight);
CHRESULT object->raw_OptimalPosition(VARIANT_BOOL GoingRight);

object

A SftMask object.

GoingRight

Specifies the direction for the optimal position.

BooleanDescription
TrueThe position is optimized by moving it to the right.
FalseThe position is optimized by moving it to the left.

Comments

The OptimalPosition method updates the caret location and makes it optimal.

An "optimal" caret location is considered a location where the user would normally enter data in a numeric field. When setting the input location (using SelStart), the OptimalPosition method can insure that the input location is valid. It insures that the input location is at a suitable location for numeric input fields.

Outside of numeric fields, this method has no effect.

Examples

VB.NET

    CalcObj.Lines = 12
    CalcObj.FracDigits = 2
    CalcObj.BackColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.Info) And &HFFFFFFFF&)
    CalcObj.ForeColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.InfoText) And &HFFFFFFFF&)
    CalcObj.TotalBackColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.Highlight) And &HFFFFFFFF&)
    CalcObj.TotalForeColor = Convert.ToUInt32(ColorTranslator.ToOle(SystemColors.HighlightText) And &HFFFFFFFF&)

    AxSftMask1.SelStart = 0 ' intentionally "bad" position
    AxSftMask1.OptimalPosition(True)
End Sub

VB6

    CalcObj.Lines = 12
    CalcObj.FracDigits = 2
    CalcObj.BackColor = vbInfoBackground
    CalcObj.ForeColor = vbInfoText
    CalcObj.TotalBackColor = vbHighlight
    CalcObj.TotalForeColor = vbHighlightText

    SftMask1.SelStart = 0 ' intentionally "bad" position
    SftMask1.OptimalPosition True
End Sub

C#

    CalcObj.Lines = 12;
    CalcObj.FracDigits = 2;
    CalcObj.BackColor = (uint) ColorTranslator.ToOle(SystemColors.Info);
    CalcObj.ForeColor = (uint) ColorTranslator.ToOle(SystemColors.InfoText);
    CalcObj.TotalBackColor = (uint) ColorTranslator.ToOle(SystemColors.Highlight);
    CalcObj.TotalForeColor = (uint) ColorTranslator.ToOle(SystemColors.HighlightText);

    axSftMask1.SelStart = 0; // intentionally "bad" position
    axSftMask1.OptimalPosition(true);
}

C++

    pCalc->Lines = 12;
    pCalc->FracDigits = 2;
    pCalc->BackColor = COLOR_INFOBK |0x80000000L;
    pCalc->ForeColor = COLOR_INFOTEXT |0x80000000L;
    pCalc->TotalBackColor = COLOR_HIGHLIGHT |0x80000000L;
    pCalc->TotalForeColor = COLOR_HIGHLIGHTTEXT |0x80000000L;

    m_pMask1->SelStart = 0; // intentionally "bad" position
    m_pMask1->OptimalPosition(VARIANT_TRUE);

    return TRUE;
}

See Also SftMask Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.