how to make cursor appear where clicked in an EditText? - android-activity

I wrote a notepad Android app but when the user scrolls and clicks say para 6 the keyboard comes and cursor appears on char no 1. How to solve this? Also tell Please how to implement find n replace.

Ok got the second part...
EditText.setText(EditText.getText().toString().replace(findstring,replacement));
But what about the cursor problem?
If user clicks on char no n...
EditText.setSelection(n);
But how to find n?

Related

Gtk.Entry autocomplete?

I am trying to do something like this picture, with a GTK Entry:
Basically, what I want is that, if the user types "keyb" (white text), the Entry will suggest "oard" (gray text) because the word "keyboard" is in a list of words, that I will provide.
I have tried the SetCompletion() function, but that opens a drop down with suggestions, and I guess I'll go with that if there is no other way. I have tried searching for it, but it is hard when you don't know the GTK word for this "technique". Can anyone point me in the right direction here?
Try this
EntryCompletion.set_inline_completion(True)
When creating an Gtk Entry Completion

KeyPressFcn in Matlabs App Designer

Hey there great ppl out there!
I have a rather simple problem but no idea how to solve it. 2h Google search didn´t help.
I´m getting hands on Matlab´s App Designer.
To keep it simple: I have a button and a numerical field. Every time I click the button - a callback is called increasing the value of the numerical field by 1.
How can I implement a KeyPress event?!? I.e. When I press the '+' Key on my keyboard I would like to trigger the callback fuction of the button (or if not possible any other function).
I´m pretty sure the developers of App Designer must have thought about this - but I´m simply to untalented to find the right documentation. I think in GUIDE there´s something called 'keypressfcn' - so I basically need an equivalent for the App Designer.
Please help :)
Increasing the Number field by 1 when hitting the button or pressing the '+' key on my keyboard
A KeyPressFcn has been added as of Matlab R2019a. In appdesigner click the Callback button, select your figure, then choose the callback 'KeyPress'. I got it to work. More info here: https://www.mathworks.com/help/matlab/ref/matlab.ui.figureappd-properties.html

click action not performed due to Softkeyboard enable(Hide the keyboard also its not working) but test is passed

I tried get login into my account using this capabilities
Android version-7.0
Appium version - 1.71
java-client - 5.8.0
selenium-standalone server -3.52.0
1.first username, password entered successfully using selenium
2.while entering password soft keyboard was enabled but I did hide keyboard also
3.But I clicked login but it is passed but where it is clicked I don't know
(I thought it might be soft keyboard issue)
Please let me know why the action not performed.
Is a native app, hybrid, web? Paste what you got until now...
Anyway, if you searched the element before the software keyboard is hidden and you try to click it after the keyboard is not longer visible... Then you could have a problem.
Add a delay for a few seconds and search again for the element and try clicking
What are you using to hide keyboard? I guess -> driver.hide_keyboard() method? Have you tried doing click at X, Y coordinates like 10,10 that are obviously out of the keyboard(for example...). Or have you tried simulating terminal back button? -> driver.back()
If 1. and 2. are not working, why don't you try with capabilities -> 'unicodeKeyboard' and 'resetKeyboard' setted to true?
You will need to provide more information to be able to help. Then I will edit my answer with code and examples

How do I set the focus of a ZK framework messagebox to the text in the box, instead of the buttons?

I have a messagebox in the ZK Framework that pops up when the user enters invalid input. It behaves as expected. We are trying to make JAWS and other screenreaders read the text of the box when it pops up.
{
Messagebox
.show("Verify that the correct Employee ID Number and/or last four of SSN were entered", "Error", Messagebox.OK, Messagebox.ERROR, -1);
}
The -1 at the end is to set the focus:
http://www.zkoss.org/javadoc/7.0.2/zk/org/zkoss/zul/Messagebox.html#show(int, int, int, java.lang.String, int)
but it sets the focus to the button itself, I've tried numbers ranging from -5 to 5 hoping it would use the button as a starting point, but that does not work. The screenreader will read the message if you use the mouse to click on it, so I know it's possible for the text to be read, but the requirement is that it's automatically read when it pops up.
Does anyone know of a way to make this happen?
Instead of using the built-in ZK MessageBox functionality, you can use the org.zkoss.zk.ui.util.Clients.evalJavaScript() function to call a JavaScript alert. This will bring focus to the popup. Although it will not be in a pretty ZK window, screen readers should read it.
Here's an example:
org.zkoss.zk.ui.util.Clients.evalJavaScript("alert('This is a popup message')");

Conversion of a character to asterisk

i had been to an interview for the post of webdeveloper/HTML developer . There he asked me a question, the ques was.... there is a textbox and a button when i enter any character into the textbox it must be converted into a asterisk sign(i.e "*")once the characters are entered now on clicking the button all the signs must be converted back into characters in a pop up.i was unable to answer this question,but i really want to know the solution for this. i think u can use javascript ,html or jquery for this i am not sure about which language is exactly used .plzzzzz suggest me the solution.
Most text boxes have a "password" mode in which you can't see the text that is entered. Just toggle the mode by clicking on the button.
Try using a textbox with a Password option, or a Password input box. Of course it would be easier to give you more specific help if you were more specific about the language and platform you are using.
In Swing you have a JpasswordField for such cases. If you are using Swing then you can use it. When the user clicks in the button just do jpassfld.setEchoChar(0) which will show the original text.
But depends on what GUI toolkit you are using. Above ws an example with Swing
Can you not just use the PasswordChar of the TextBox?
In C#, to set the PasswordChar:
TextBox1.PasswordChar = '*';
To remove the PasswordChar on the button click:
TextBox1.PasswordChar = (char)0;
Depending on the programming language and editor, usually a text box has a property that makes it behave like a password entry field. Simply connect your button to toggle that property.
Sorry for that generic answer, but your question is very vague.