EditText loses focus when keyboard appears; requires touching twice to edit [duplicate]

A solution is to post a delayed runnable that checks to see if the EditText view is still focused, and if it is not, focus it. editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(final View v, boolean hasFocus) { if (hasFocus) { // Request focus in a short time because the // keyboard may steal it … Read more

jQuery focus without scroll

Try this: $.fn.focusWithoutScrolling = function(){ var x = window.scrollX, y = window.scrollY; this.focus(); window.scrollTo(x, y); return this; //chainability }; and then $(‘#link’).focusWithoutScrolling(); Edit: It’s been reported that this doesn’t work in IE10. The probable solution would be to use: var x = $(document).scrollLeft(), y = $(document).scrollTop(); but I haven’t tested it.

How to set the focus on a hidden textbox field using JavaScript?

If you really need to do this, make the box transparent, not hidden: opacity:0; filter:alpha(opacity=0); Alternatively, if you want to ensure that the user doesn’t accidentally click it, just place the input inside a div with width: 0; overflow: hidden; However, there is most certainly a better way to do what you want, maybe using … Read more

Get a notification/event/signal when a Qt widget gets focus

You can add en event filter. This is an example of an application written with QtCreator. This form has a QComboBox named combobox. MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); ui->comboBox->installEventFilter(this); . . . } bool MainWindow::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::FocusOut) { if (object == ui->comboBox) { qWarning(object->objectName().toLatin1().data()); } } return … Read more

jquery Setting cursor position in contenteditable div

Maybe I’m misreading the question, but wouldn’t the following do (assuming an editable <div> with id “editable”)? The timer is there because in Chrome, the native browser behaviour that selects the whole element seems to trigger after the focus event, thereby overriding the effect of the selection code unless postponed until after the focus event: … Read more

Is there any way in JavaScript to focus the document (content area)?

In HTML 4.01, focus is only discussed in the context of elements such as form controls and links. In HTML 5, it is discussed much more widely. However, how focus works for documents is mostly browser dependent. You might try: // Give the document focus window.focus(); // Remove focus from any focused element if (document.activeElement) … Read more

iOS input focused inside fixed parent stops position update of fixed elements

It’s a well known bug on Safari, both on iPad and iPhone. A workaround it’s to change the position to absolute to all elements set with fixed position. In case you are using Modernizr you could also target mobile devices this way: jQuery code $(document).ready(function() { if (Modernizr.touch) { $(document) .on(‘focus’, ‘input’, function(e) { $(‘body’).addClass(‘fixfixed’); … Read more

I have to click the button twice for it to work

My problem was the Button XML defining: android:focusableInTouchMode=”true” Remove this attribute and the button doesn’t require being touched twice. It appears as though the first touch is consumed to assign focus on the button and the second then triggers the OnClickListener. Note that the Button works without issue with the android:focusable=”true” attribute.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)