StrataFrame Forum

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

http://forum.strataframe.net/Topic32661.aspx

By Rogerio Mauri - 9/4/2014

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.
By Ivan George Borges - 9/4/2014

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.
By Rogerio Mauri - 9/4/2014

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. 
By Ivan George Borges - 9/4/2014

Would it work if you set its Enable property to False?
By Rogerio Mauri - 9/5/2014

When we use this property there are other problems. 





By Ivan George Borges - 9/5/2014

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.
By Rogerio Mauri - 9/21/2014

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