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


Author
Message
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 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

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Not sure what might be going on there. Maybe I could try and reproduce it from my side, but for a start, I can tell you that I have lots of ComboBoxes which Enable properties are being set to False and it's been working just fine.

Also, reading the posts you mentioned, I noticed that in the end you state that you couldn't reproduce it on a test project and that you would investigate more in details what could be happening. Since you didn't come back with more information, I bet Trent assumed you had found something on your code.
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
When we use this property there are other problems. 





Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Would it work if you set its Enable property to False?
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)
Group: StrataFrame Users
Posts: 205, Visits: 629
Hi Ivan...

But in help documentation StrataFrame:

--------------

What's New In Version 1.6.5.

PreventDropDown property on a combo box has been added [440]

A new property has been to the combo box that will prevent the end-user from dropping down the list. This can be a useful tool when access to the drop down may need to be restricted for a period of time (modifying a record, for example).

--------------

Do not allow the user to change the record. This is expected. 

Rogério Mauri Smile

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Rogerio.

That seems to make sense to me, since the property is saying that it will prevent the combo from dropping down its list, but not that you won't be able to navigate through its items using the arrow keys.
Rogerio Mauri
Rogerio Mauri
StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 reputation)StrataFrame User (303 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

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search