defocus button after clicking it

时间:2017-08-30 20:48:21

标签: vb.net focus

At vb project i have 3 buttons (checkbox with buttons appeareance)... if i click 1 of them it remains selected (focused),

i will control that program with a small RF keyboard, i suffer of pressing the space key very easy!!

how can i deselect (loose the focus) of that control to avoid the accidental activation-deactivation by space pressing?? i've tried adding a hidden button, and focussing it on the click event of the check-buttons"... like:

0.20.3

but dont works!, later i've tried to focus the mainform but also it dont work!

In [174]: lookup = pd.to_datetime(filter1[filter1.columns[0]][0:2])

In [175]: df2.ix[lookup]
Out[175]: 
                        t1       1     t4       4     t6       6
Fecha_hora                                                      
2014-08-06 12:20:00  19.85  311.55  17.85  248.68  19.78  547.21
2014-08-06 13:00:00  20.28  356.96  18.92  307.57  21.15  471.18

also i've tried:

reader: {
    type: 'json',
    rootProperty: '',
    transform: function(data) {
        return Ext.Array.map(data, function(nestedDataArray) {
           return nestedDataArray[0];
        });
    }
}

but still no working after clicking(cheking) the button it can be easily unchecked clicking the space key again!! wich is the correct way to avoid the accidental unchecking??

thanks.

2 个答案:

答案 0 :(得分:1)

您似乎正在使用WinForm。 Form作为名为ActiveControl的属性,可以设置为Nothing(null)。在CheckBox.CheckedChanged处理程序中执行此操作,将取消关注 CheckBox并阻止您遇到的问题。

Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
    Me.ActiveControl = Nothing
    ' any other necessary code
End Sub

答案 1 :(得分:0)

Why not just disable the SPACE and ENTER keys completely for your check box(es)?

LinkedObject