ComboBox.PreventDropDown - Control items are free with the TAB key.


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
cbIdUnidade.PreventDropDown = true;

However, when the user navigates through the fields with the TAB key, the control items are free to choose with arrows up and down.

Rogério Mauri Smile

Reply
Rogerio Mauri
Rogerio Mauri
StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)StrataFrame User (439 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
This is the componente code:

       ''' <summary>
        ''' Override to prevent logic from executing under certain circumstnaces
        ''' </summary>
        ''' <param name="m"></param>
        ''' <remarks></remarks>
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            '-- Determine if the drop down should be prevented
            If _PreventDropDown Then
                '-- WM_LBUTTONDOWN or WM_LBUTTONDBLCLK 
                If m.Msg = &H201 OrElse m.Msg = &H203 Then Return
            End If

            MyBase.WndProc(m)
        End Sub

My suggestion:

       ''' <summary>
        ''' Override to prevent logic from executing under certain circumstnaces
        ''' </summary>
        ''' <param name="m"></param>
        ''' <remarks></remarks>
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            '-- Determine if the drop down should be prevented
            If _PreventDropDown Then
                '-- WM_LBUTTONDOWN or WM_LBUTTONDBLCLK or WM_KEYDOWN
                If m.Msg = &H201 OrElse m.Msg = &H203 OrElse m.Msg = &H100 Then Return
            End If

            MyBase.WndProc(m)
        End Sub 

Rogério Mauri Smile

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search