Sign in to follow this  
Followers 0
t0ddie

question about focus

2 posts in this topic

$current = _GUICtrlTabGetCursel ($tab)

If $var1 = 0 And $current = 0 Then

GUICtrlSetState($d1, $GUI_FOCUS)

EndIf

$d1 is the control input

$var1 is the amount of characters in the control input

and basically what i am doing here, is keeping the cursor (not the mouse cursor, but the blinking "pipe" (|). ) on that input if it is on the first tab, and until something is typed into it, because when you click on other places in the gui the cursor dissappears from the input. (loses focus)

so sometimes when you arent looking at the monitor, and your typing.. then you look up and nothing was typed because you lost focus accidentally, its pretty frustrating.

the problem i am having, is that i have buttons that i would like to be able to use while that cursor is still on the control input. and i cant use them, because the focus is on the control input and the buttons do not work.

so i would more or less, (without CLICKING) like to keep the cursor on the control input, and not neccissarily keep any focus on it.

possible?


Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites



$current = _GUICtrlTabGetCursel ($tab)

  If $var1 = 0 And $current = 0 Then

      GUICtrlSetState($d1, $GUI_FOCUS)

  EndIf

$d1 is the control input

$var1 is the amount of characters in the control input

and basically what i am doing here, is keeping the cursor  (not the mouse cursor, but the blinking "pipe" (|). ) on that input if it is on the first tab, and until something is typed into it, because when you click on other places in the gui the cursor dissappears from the input. (loses focus)

so sometimes when you arent looking at the monitor, and your typing.. then you look up and nothing was typed because you lost focus accidentally, its pretty frustrating.

the problem i am having, is that i have buttons that i would like to be able to use while that cursor is still on the control input. and i cant use them, because the focus is on the control input and the buttons do not work.

so i would more or less, (without CLICKING) like to keep the cursor on the control input, and not neccissarily keep any focus on it.

possible?

<{POST_SNAPBACK}>

Something like this?

While 1

Select
Case 1
    Go do a function
Case 2
    Go do another function
Case 3
    Go do yet another function
Case Else
    If ControlGetFocus(control1) <> $controlname then
         If StringLen(GuiCtrlRead(control1)) < 1 Then; if nothing has been entered
            ControlFocus(control1) ; go back to this control
         Endif
   Endif
EndSelect
WEnd

Without testing I'm pretty sure that Case Else would keep dragging the cursor back to control1 if you don't put in some way of telling the program it's okay to let it go under certain conditions, for example, if somethings been entered into that control.

hth

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0