2009-05-01 57 views
2

好的,我有代碼工作(在此之後張貼),但在我擴大之前,我想把它扔在這裏,看看也許更好的方式做我在做什麼。備用輸入移動緊湊框架 - 按鈕和設備鍵盤

問題:SIP面板很糟糕 - 有時我需要的只是輸入到移動應用程序中的數字或字母 - 我的大多數用戶最終不使用手寫筆,而是使用手指,因此我需要在屏幕上創建大按鈕只需填寫一個數字或字母,填寫目前正在處理的任何文本框。它還需要同時接受來自設備鍵盤的輸入。

我當前的代碼:

頂代碼:

'setup a object to hold the current input box 
Public currentInputBox As TextBox 

'setup the user for input into a text box 
currentInputBox = LadingOrderQtyTextBox 
ladingOrderQtyTextbox.Focus() 


'Routine to handle the numeric screen button '0' 
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 
    currentInputBox.Text = currentInputBox.Text & "0" 
    'Make sure to move to the end of the text... 
    currentInputBox.SelectionStart = currentInputBox.Text.Length 
    'give focus back 
    currentInputBox.Focus() 
End Sub 

這並不工作,但它需要我手動跟上什麼文本框的用戶當前正在...也許有沒有辦法繞過這個?

無論如何,我期待着羣體的想法...

也...有沒有更好的辦法,張貼在這裏的代碼?

+0

修復了您的代碼示例,您只需要將它縮進4個空格 – 2009-05-01 12:42:03

+0

要添加代碼塊,請按四個空格縮進或選擇代碼並單擊textarea上方的「101010」圖標。要在等寬線中添加內聯代碼,請將其圍繞反引號(`)。 – tpdi 2009-05-01 12:43:38

回答

2

獲得正確行爲的最佳方式是具有您想要的功能的create a custom SIP。這將允許您喜歡的任何「模式」,以及所需的按鈕佈局,大小等。