cursor automatically move from one uitextfield to other textfield in ios? - ios6

I have 4 uitextfield controls if textfield length is 1 move to next uitextfield and hitting backspace delete one by one textfield text in reverse direction.
like ipad unlock passcode while startup.

You can use the UITextField delegate method to move to the next text field:
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
if (textField == textFieldA) {
[textField resignFirstResponder];
[textFieldB becomeFirstResponder];
} else if (textField == textFieldB) {
// etc...
}
return YES;
}
For the Delete or Backspace key you try something like this:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
Other than that, I don't know of any other ways to catch keyboard events in iOS.

Related

How to create a border for SCNNode to indicate its selection in iOS 11 ARKit-Scenekit?

How to draw a border to highlight a SCNNode and indicate to user that the node is selected?
In my project user can place multiple virtual objects and user can select any object anytime. Upon selection i should show the user highlighted 3D object. Is there a way to directly achieve this or draw a border over SCNNode?
You need to add a tap gesture recognizer to the sceneView.
// add a tap gesture recognizer
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap(_:)))
scnView.addGestureRecognizer(tapGesture)
Then, handle the tap and highlight the node:
#objc
func handleTap(_ gestureRecognize: UIGestureRecognizer) {
// retrieve the SCNView
let scnView = self.view as! SCNView
// check what nodes are tapped
let p = gestureRecognize.location(in: scnView)
let hitResults = scnView.hitTest(p, options: [:])
// check that we clicked on at least one object
if hitResults.count > 0 {
// retrieved the first clicked object
let result = hitResults[0]
// get its material
let material = result.node.geometry!.firstMaterial!
// highlight it
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.5
// on completion - unhighlight
SCNTransaction.completionBlock = {
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.5
material.emission.contents = UIColor.black
SCNTransaction.commit()
}
material.emission.contents = UIColor.red
SCNTransaction.commit()
}
}
The snippet above highlights the whole node. You'd have to adjust it to highlight the borders only, if that's what you're looking for.
Disclaimer:
This code was taken directly from Xcode's template code created when opening a new game (SceneKit) project.

XPages get Value selected from combo box

I want to display the selected value from the comboBox into a label.
<xp:label id="label4">
<xp:this.value><![CDATA[#{javascript:var componenta = Contr.getItemValueString("txt_tipcontractcv");
if (componenta == "")
{ return "void";}
if (componenta !="")
{ return "My value is "+componenta}}]]></xp:this.value>
</xp:label>
The label is on a panel, and I did a partial refresh to the respective panel.
My comboBox is binded to a data element.
label4 is always void. Why?
Thank you,
Florin
I changed code into:
var componenta = getComponent("combo").getValue();
if ((componenta == null) || (null == componenta))
{ return "void";}
else if ((componenta != null) || (null != componenta))
{ return "My value is "+componenta}
and now it returns : My value is
It seems that componenta is an empty string. Why?
Try Contr.getValue("txt_tipcontractcv") (assuming that Contr is your datasource).
The reason is the value selected is not sent to the server.
Could you give us the code for combobox, and panel with label. It will give us clear idea for the cause
Are you using partial execution mode?
Is combo box bind to data source value="Contr.txt_tipcontractcv"?
You may also code the label as below, if that suits
<xp:label id="label4" value="Contr.txt_tipcontractcv" />

extjs Keydown for Tab back key press(Shift + Tab)

I have grid column key down event function I want to catch back Tab key press event
mycol.editor.addLissiner('keydown',keydownfunc(), this);
keydownfunc : function(txtField, e) {
var key = e.getKey();
if(key == Ext.EventObject.TAB){
alert('tab);
}
if(key == TAB+SHIFT){
alert('backtab');
}
}
I can catch Tab key press using key == Ext.EventObject.TAB but i can't catch back tab press key event. Please help tell what i do for catch back tab(shift+tab) event
Try checking 'Ext.EventObject.shiftKey' inside TAB key handler to determine shift key is pressed or not...
you can observe :
"http://jsfiddle.net/mohammad_erdin/sDFfY/"
this will surely help you.

WPF Datagrid Selection Issue

In my WPF application I have one datagrid and one textbox. In the textChanged event of the textbox, I put this:
myDatagrid.ItemsSource =
myListOfObjects.Where(item => item.Name.Contains(MyTextBox.Text)); //Filter
if (myDatagrid.Items.Count > 0) // If no itens, then do nothing
{
myDatagrid.SelectedIndex = 0; // If has at least one item, select the first
}
myDatagrid.Items.Refresh();
Note that I force the selection when the text changes, in the first row of the DataGrid.
But unfortunately, the color of the row does not change to blue, making it hard to see the selection.
I realy need this, because in the PreviewKeyDown event of the textbox I have this:
private void myTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Up)
{
if (!(myDataGrid.SelectedIndex <= 0))
{
myDataGrid.SelectedIndex--; // Go one position Up
}
}
if (e.Key == Key.Down)
{
if (!(myDataGrid.SelectedIndex == myDataGrid.Items.Count - 1))
{
myDataGrid.SelectedIndex++; // Go one position Down
}
}
}
So, when the textbox is focused and the user press the Up or the Down key, the selection does not appear to change.
Any idea of how I can make the selected item on the datagrid change it's color to blue?
Other thing: in my virtual machine, it works!! With the same code! How it's possible?
I think that is the aeroglass, but I change the theme to the Windows 7 Basic (same in the virtual machine) and still don't work.
Thanks, and sorry for my english.
Could you try using SelectedItem? you could always create a new property and bind to this and then set this item directly rather than using the selected index. Hopefully this would trigger any additional logic in the DataGrid control :)
//Declare property outside of method
public ObjectType SelectedItem { get; set; }
//Set datacontext on load
DataContext = this;
myDatagrid.ItemsSource = myListOfObjects.Where(item => item.Name.Contains(MyTextBox.Text)); //Filter
if (myDatagrid.Items.Count > 0) // If no itens, then do nothing
{
SelectedItem = myDatagrid.ItemSource[0]; // If has at least one item, select the first
}
myDatagrid.Items.Refresh();
Also don't forget to set your binding!
SelectedItem="{Binding SelectedItem}"
hope that helps!

How to use the Insert Key (like in traditional windows) for a WPF 4 App?

Ok, I know that the new versions of windows do not use the insert key by default and you have to program for it. I want to be able to type in my text box and override the content that is in it just like in old windows when you could activate the insert key. This is just for my WPF 4, VB.net Application.
Updated Information:
That what I meant: I need to mimic old terminals. I need to activate the overwrite mode programmatically for all the controls. The same affect as the 'Insert' key on the keyboard. Only that key does not work in a WPF environment.
Example I am entering the word world over a text box that says 'Hello!':
Textbox Started as: [Hello!]
The Textbox is now [World!]
You will note that the one character exclamation mark stayed because world is not enough characters to replace the '!'.
Try this out (use this control instead of vanilla TextBoxes):
public class InsertModeTextBox : TextBox
{
public InsertModeTextBox()
{
InitializeComponent();
}
protected override void OnTextInput(TextCompositionEventArgs e)
{
var txt = e.Text;
var len = txt.Length;
var pos = CaretIndex;
var builder = new StringBuilder();
if (pos > 0) builder.Append(Text.Substring(0, pos)); // text before caret
builder.Append(txt); // new text
if (Text.Length > pos + len) builder.Append(Text.Substring(pos + len)); // text after overwrite
Text = builder.ToString();
CaretIndex = pos + len;
e.Handled = true;
}
}
In WPF 4 pressing Insert key when textbox has focus activates overwrite mode. Do you mean changing between Insert and Overwrite modes for all textboxes on a window at once?

Resources