Questions tagged [setfocus]

For questions related to the SetFocus method, which moves the focus to the specified form or Window.

The SetFocus method moves the focus to the specified Form, the specified control on the Form/Window, or to the specified Window. You can use the SetFocus method when you want a particular field or control or Window to have the focus so that all user input is directed to this object.

430 questions
15
votes
3 answers

how to set focus on a div using javascript or jquery when # already added in url?

I want to set focus on particular div using jquery or javascript. i have just use document.getElementById("pack_0").focus(); in that 'pack_0' is my div id but it doesn't work. I notice that '#' is already added in my url because of some popup…
Jimesh Gajera
  • 612
  • 1
  • 11
  • 32
14
votes
4 answers

Setting focus on a button is not working

I am trying to set the focus to a button while the user presses the Enter key in the text box. But it is not working. I am using the Internet Explorer 8 browser. Am I missing something? $("input.Box").live('keydown', function(e) { if (e.keyCode…
Bhaskar
  • 1,680
  • 7
  • 26
  • 40
14
votes
2 answers

WPF Window set Focus

I have a WPF Window which I only create one time and then Show() and Hide() several times. Now I am searching a way to set the focus on a element on each Show(). Where and how can I do this?
BennoDual
  • 5,865
  • 15
  • 67
  • 153
14
votes
2 answers

How to use manual focus in Android CameraX?

I am trying to do manual focus on CameraX the same as I do in Camera2 API in Camera2 API I use the following code final CaptureRequest.Builder captureBuilder = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);…
moLand
  • 143
  • 1
  • 6
12
votes
3 answers

set focus in input element after submit and reset form

I'm working with a template form component with angular2 and I cannot get to set the focus in my firstName input element after submit the form. The form is reseted fine but no way of setting focus. This is my component code: export class…
miguelferdis
  • 121
  • 1
  • 4
11
votes
4 answers

When I select next from my android device, while filling a form, it skips any drop down

I have a web form consisting of input text boxes, drop downs and submit button. When I use my website on android phone - chrome browser(or any browser on my android device, I am using next on my phone keyboard to navigate to the next field. the…
nisha kanani
  • 273
  • 1
  • 4
  • 16
10
votes
1 answer

How to force a focus on a component before the Form is shown

I have to show (with ShowModal) a Form with many TEdit but I want to force the focus on a TEdit, but not always the same, depending on the context. I can't use SetFocus before the ShowModal (because the Form is not activate) and use the component…
philnext
  • 3,242
  • 5
  • 39
  • 62
9
votes
2 answers

How to set initial focus on input field on page load (with VueJS 3 using Composition API)

How can I set the focus on an HTML input field upon page loading while using the Composition API of VueJS 3? I have the following HTML:
And have tried this in the setup() function, but…
Eugene
  • 173
  • 1
  • 10
9
votes
3 answers

EditText loses focus on Scroll in RecyclerView

I have a RecyclerView which have EditText as its list items. When i scroll the RecyclerView, the EditText loses focus when the item goes off screen. So the focus does not remain on the EditText when it comes back on the screen on scroll. I want the…
kanudo
  • 2,119
  • 1
  • 17
  • 33
9
votes
1 answer

How to set Focus to a WPF Control using MVVM?

I am validating user input in my viewmodel and throwing validation message in case validation fails for any of values. I just need to set the focus to the particular control for which validation has failed. Any idea how to achieve this ?
user2519971
  • 345
  • 3
  • 12
  • 27
8
votes
1 answer

Focus event with dispatchEvent

When I trigger a focus event with dispatchEvent on an input box, its onfocus is called, but on the UI the input box is not focused. Is there any reason for this behavior? var test = document.getElementById("test"); test.onfocus = function(event) { …
Viktor
  • 6,739
  • 7
  • 26
  • 29
8
votes
4 answers

How to set focus to editText when fragment start?

When MyFgment appear in screen, I want to set cursor focus on EditText in MyFragment automatically. I've tried EditText.requestFocus(), but it doesn't focus on EditText. How can I do??
hanjiman
  • 465
  • 1
  • 6
  • 17
8
votes
2 answers

Set focus on winform after start

I found a few topics about this but none of these could help me with my problem, i want to set the focus on a new created winform window after it started. I'm starting the form in a own new thread with: application.Run(new InvisibleForm()); and…
dontcare
  • 935
  • 3
  • 16
  • 34
7
votes
1 answer

jquery last focused element

I have a basic login form, which uses ajax to login users. If the details are incorrect text is displayed showing login has failed. When this is shown the last textbox the user entered text in loses focus. Is it possible to set focus to the last…
Elliott
  • 3,812
  • 24
  • 69
  • 93
7
votes
1 answer

C - win32: AttachThreadInput & SetFocus, 64bit: no clue

I've commented in most of what I know. I'm fairly confident the issue arises at AttachThreadInput. It was only designed to function under 32bit, I think. Believe me, if I could solve this myself, I would be happy to. I read the full documentation…
user1438942
1
2
3
28 29