我一直在用xcode编写iphone应用程序,有一个包含电话号码字段的表单.它必须包含10位数字.如果用户首先在键盘中按0,则应用程序不得写入.
例如,电话号码05551234567,用户只能写5551234567.如果用户按0,则没有任何反应.
我想更改外部应用程序的编辑控件的文本.该应用程序是用Delphi编写的.它有几种形式.我开始用Python库pywinauto+ sendkeys测试第一种形式TLoginForm.它完美地运作.这是伪代码:
helper = pywinauto.application.Application()
hwnd = pywinauto.findwindows.find_windows(class_name='TLoginForm')[0]
window = helper.window_(handle=hwnd)
ctrl = window[2] # the second control is the edit control I want to access
ctrl.ClickInput() # focus the control
ctrl.SetEditText('Hello world') # text can be changed expectedly
Run Code Online (Sandbox Code Playgroud)
作为第二步,我想为自动化工具制作UI.但由于缺乏Python UI知识并考虑到在Python中分发二进制文件的复杂性,我想做Delphi.但奇怪的是我无法使用Windows apis在Delphi中读/写编辑控件.以下是一些尝试:
SetForegroundWindow(EditControlHandle); // Works, the application will be brought to front, the edit control will be focused
// Attempt 1: Nothing happens
SetFocus(AnotherEditControlHandle);
// Attempt 2: Nothing happens
SetWindowText(EditControlHandle, 'Hello world');
// Attempt 3: …Run Code Online (Sandbox Code Playgroud) 在主视图中,我在UITableView另一个视图下面,textInputView包含a UITextField和a UIButton.
向上移动UIView包含UITextField,UIButton当键盘显示不起作用时.
-(void)animateTextField:(UITextField*)textField up:(BOOL)up
{
const int movementDistance = -224; // tweak as needed
const float movementDuration = 0.3f; // tweak as needed
int movement = (up ? movementDistance : -movementDistance);
[UIView beginAnimations: @"animateTextField" context: nil];
[UIView setAnimationBeginsFromCurrentState: YES];
[UIView setAnimationDuration: movementDuration];
textInputView.frame = CGRectOffset(textInputView.frame, 0, movement);
[UIView commitAnimations];
}
- (void)textFieldDidBeginEditing:(UITextField *)textField{
[self animateTextField:textField up:YES];
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
[self animateTextField:textField up:NO];
}
Run Code Online (Sandbox Code Playgroud)
如果我用self.view它替换textInputView …
在我的应用程序中,我实现了泰米尔语,德语键盘和英语有默认键盘,现在我选择了泰米尔键盘,但我收到英语发送单个消息后的默认键盘,我得到一个选定的键盘.现在我需要第一次选择键盘.请帮我
按下键盘的搜索按钮时如何隐藏键盘?
当用户完成在edittext中的输入并按键盘上的“搜索按钮”时,键盘应处于隐藏状态。
我意识到这个问题已被多次提出,但它似乎是由许多不同的事情引起的,并且非常具有情境性.
我的踪迹:
2015-02-27 16:20:06.289 RTApp[43486:1122681] -[RTApp.conversationVC keyboardWasShown]: unrecognized selector sent to instance 0x7f866a766830
2015-02-27 16:20:06.291 RTApp[43486:1122681] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RTApp.conversationVC keyboardWasShown]: unrecognized selector sent to instance 0x7f866a766830'
*** First throw call stack:
(
0 CoreFoundation 0x00000001071b8f35 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000106e51bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001071c004d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010711827c ___forwarding___ + 988
4 CoreFoundation 0x0000000107117e18 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x0000000107188cec __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
6 CoreFoundation 0x00000001070888a4 _CFXNotificationPost …Run Code Online (Sandbox Code Playgroud) 我最近迁移到Vim。但是由于我现有的箭头键的肌肉记忆能力,我很难使用“ hjkl”键进行导航。
1.有没有一种方法可以有效地使用“ ijkl ”之类的其他键(靠近箭头键布局),而又不会与VIM中的其他功能造成太多冲突,例如:http : //vim.wikia.com/wiki/Use_ijkl_to_move_the_cursor_and_h_to_insert 和http ://ergoemacs.org/misc/on_vi_keybinding.html
2. 用“ hjkl”重新训练肌肉记忆是否值得努力?但是问题是,我必须在Web浏览器,Outlook和文字处理器中再次使用箭头键 (因此,这种转变引起了冲突)。
您能否建议(对#2感兴趣),您是如何处理的?
所以我有一个带有文本字段的视图,但文本字段在底部。当我单击键盘时,它会弹出并覆盖文本字段,这是我的问题。我想知道当键盘出现时是否有可能将其余视图向上推?
我创建了一个具有以下属性的文本字段:
keyboardType: Ti.UI.KEYBOARD_DECIMAL_PAD
returnKeyType: Ti.UI.RETURNKEY_DONE
Run Code Online (Sandbox Code Playgroud)
我在iphone设备上测试了这个.出现小数点,但没有完成按钮.
我也试过其他按钮类型,没有成功.似乎无法设置returnKeyType为KEYBOARD_DECIMAL_PAD.
当我将键盘类型更改为KEYBORD_DEFAULT或KEYBOARD_NUMBERS_PUNCTUATION它的工作原理.
最后一个选项(KEYBOARD_NUMBERS_PUNCTUATION)是我可以使用的替代方案,但有人可以告诉我为什么它不能使用KEYBOARD_DECIMAL_PAD?
谢谢.
keyboard ×10
ios ×4
iphone ×3
android ×2
objective-c ×2
swift ×2
xcode ×2
appcelerator ×1
delphi ×1
key-bindings ×1
python ×1
pywinauto ×1
subview ×1
text ×1
uitextfield ×1
vim ×1