Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

CWNumEdit gets stuck occasionally when clicking up or down

I have a few CWNumEdit objects in my ActiveX EXE Document. And occasionally when I click the up or down arrows they get stuck. After clicking the up/down arrow once, no matter where on the form I click, the up (or down button) fires.

Thanks,
Eric
0 Kudos
Message 1 of 4
(3,556 Views)
Eric,

I've never seen this behaviour with a CWNumEdit control. This could be related to what you are doing in the callback function for that control. You may want to try to add a DoEvents call to keep up the user interface management while the callback function is executed. Do you have more specifics on what the application does in the callback?

Juan Carlos
National Instruments
0 Kudos
Message 2 of 4
(3,556 Views)
There's probably a better way of doing what I'm trying to do. I need to send data to a server when the value changes. However, I don't want to send it while it's scrolling because I don't want to send 100 requests to the server if I scroll from 1 to 100, so I only send it when they click up with the mouse (if changed hoping triggered when the up/down arrow was pressed) or when they press enter. So I do the following. If you have a better idea, I'd love to hear it.

Dim blnFlowRateChanged As Boolean

Private Sub txtFlowRate_KeyPress(KeyAscii As Integer)
If blnFlowRateChanged Then
If KeyAscii = 13 or KeyAscii = 10 Then
SendData "FlowRate=" & txtFlowRate.Text
blnFlowRateChanged = False
End If
End If

End Sub

Private Sub txtFlowRate_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If blnFlowRateChanged Then
SendData "FlowRate=" & txtFlowRate.Text
blnFlowRateChanged = False
End If
End Sub

Private Sub txtFlowRate_ValueChanged(Value As Variant, PreviousValue As Variant, ByVal OutOfRange As Boolean)
blnFlowRateChanged = True
End Sub
0 Kudos
Message 3 of 4
(3,556 Views)
I have an idea for you, this may or may not work for your specific application, you can create a call back to send the data to the server when the numeric control looses the focus, this would force the user to click outside the numeric control to cause the value to be sent. Combining this with some sort timer to check for the time that the control has had focus you could create an applications that sends the value only when necessary.

I hope this helps, I�ll let you know if I can think of anything else.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 4 of 4
(3,556 Views)