Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

UpDownPress Event, SftMask Object

The up/down button is pressed.

Syntax

VB.NETPrivate Sub object_UpDownPress(ByVal sender As Object, ByVal e As EventArgumentType) Handles object.UpDownPress
VBPrivate Sub object_UpDownPress(ByVal Up As Boolean, ByVal FieldStart As Long, ByVal FieldEnd As Long, ByVal Counter As Long, Field As String)
C#.NETvoid object_UpDownPress(object sender, EventArgumentType e);
VC++void OnUpDownPressobject(VARIANT_BOOL Up, long FieldStart, long FieldEnd, long Counter, _bstr_t* Field);
CHRESULT OnUpDownPressobject(VARIANT_BOOL Up, long FieldStart, long FieldEnd, long Counter, BSTR* Field);

object

A SftMask object.

Up

True if the upper button was pressed, usually indicating a value increment or False if the lower button was pressed.

FieldStart

The starting position of the numeric field.

FieldEnd

The length of the numeric field.

Counter

The current event counter. The event count starts at 0 when the up/down button is first pressed (or when the up/down arrow key is used). While the button (or key) remains pressed, the UpDownPress event occurs at regular intervals (every 0.1 seconds), each time the Counter value is incremented by 1. This can be used to delay additional increments or decrements by waiting until Counter reaches a certain value. It can also be used to accelerate or increase the increment used. The example below shows how this can be implemented.

Field

The contents of the numeric field as a string. The application returns a new string value in this argument. If the Field value is not modified by the application, the up/down button have no effect.

Comments

The UpDownPress event occurs when the up/down button is pressed.

The UpDownPress event only occurs for numeric fields without minimum/maximum range.

The UpDownHandled event occurs after the UpDownPress event, indicating that the control contents have been modified using the up/down button.

Examples

VB.NET

    SftMaskSSN.Text = "444-12-1111" ' a social security number
    SftMaskToday.Contents.DateTime = Today ' set today's date
    SftMaskTime.Contents.DateTime = TimeOfDay
    SftMaskPercent.Contents.Value(0) = 50 ' start with 50 percent
    SftMaskAmount.Text = CStr(199)
    SftMaskIPAddr.Text = "209.61.201.49"
End Sub

Private Sub SftMaskAmount_UpDownPress(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_UpDownPressEvent) Handles SftMaskAmount.UpDownPress
    Dim Amount As Double
    Dim Increment As Single
    If e.counter = 0 Or e.counter > 5 Then
        Amount = Val(e.field)
        Increment = 0.01
        If e.counter > 14 Then Increment = 0.1
        If e.counter > 23 Then Increment = 1

VB6

    SftMaskSSN.Text = "444-12-1111" ' a social security number
    SftMaskToday.Contents.DateTime = Date ' set today's date
    SftMaskTime.Contents.DateTime = Time
    SftMaskPercent.Contents.Value(0) = 50 ' start with 50 percent
    SftMaskAmount.Text = 199
    SftMaskIPAddr.Text = "209.61.201.49"
End Sub

Private Sub SftMaskAmount_UpDownPress(ByVal Up As Boolean, ByVal FieldStart As Long, ByVal FieldEnd As Long, ByVal Counter As Long, Field As String)
    Dim Increment As Single
    If Counter = 0 Or Counter > 5 Then
        If Val(Field) = 0 Then
            Field = 0
        End If
        Increment = 0.01
        If Counter > 14 Then Increment = 0.1

C#

    SftMaskIPAddr.Text = "209.61.201.49";
}

private void Command1_Click(object sender, System.EventArgs e)
{
    Application.Exit();
}

private void SftMaskAmount_UpDownPress(object sender, AxSftMaskLib70._ISftMaskEvents_UpDownPressEvent e)
{
    double amount;
    double increment;
    if (e.counter == 0 || e.counter > 5) {
        amount = Convert.ToDouble(e.field);
        increment = 0.01;
        if (e.counter > 14) increment = 0.1;

C++

    pFont->put_Bold(TRUE);
    ISftMaskCaptionPtr pCapt = m_vSftMaskIPAddr->GetCaption();
    pFont = pCapt->GetFont();
    pFont->put_Italic(TRUE);

    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CSample1Dlg::OnUpDownPressSftMaskAmount(BOOL Up, long FieldStart, long FieldEnd, long Counter, BSTR FAR* Field)
{
    double Incr;

    if (Counter == 0 || Counter > 5) {
        wchar_t* endchar;
        double Val = wcstod(*Field, &endchar);

See Also SftMask Events | Object Hierarchy


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