Jump to content

GUICtrlGetState


Recommended Posts

$d2 = GUICtrlCreateInput("", 140, 140, 30, 20)

$dd2 = GUICtrlGetState($d2)

no matter if the cursor is on the input box or not, $dd2 always returns 80

i need to be able to detect whether focus is currently on that inputbox, or another one.

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

Link to comment
Share on other sites

$d2 = GUICtrlCreateInput("", 140, 140, 30, 20)

$dd2 = GUICtrlGetState($d2)

no matter if the cursor is on the input box or not,  $dd2 always returns 80

i need to be able to detect whether focus is currently on that inputbox, or another one.

<{POST_SNAPBACK}>

ControlGetFocus ??

"Returns the ClassNameNN of the control that has keyboard focus within a specified window"

hth

HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Link to comment
Share on other sites

ok, the first box is Edit1 and the eighth box is Edit8

so this isnt working...

$var2 is the amount of characters in the second message box.

$d1 is the first inputbox

$focus = ControlGetFocus("yo mammy")
  

                
    If _IsPressed('08') And $var2 = 0 And $focus = "Edit2" Then
        GUISetState($d1,$GUI_FOCUS)
                GUISetState($d1,$GUI_FOCUS)
    EndIf
    
Func _IsPressed($hexKey)

  
  Local $aR, $bRv
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

  If $aR[0] <> 0 Then
     $bRv = 1
  Else
     $bRv = 0
  EndIf
  
  Return $bRv
EndFunc

what im trying to do, is if the user presses backspace when they are in the second inputbox, and theres no data in it, that it goes back to the first inputbox.

not working though...

and i put this in twice

"GUISetState($d1,$GUI_FOCUS)"

because if you add focus to an inputbox with data in it, it highlights it and i dont want that. im hoping when it does work that calling it a second time will unhighlight it.

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

Link to comment
Share on other sites

ok, so i have 8 inputboxes here people.. and i want to treat them as if they are one box. but each can hold 4 characters.

so i already have logic saying, if theres 4 characters in the box, go to the next one.

so i can type smoothly between boxes without having to click each one.

but i cant go backwards. i tried with the iskeypressed function but its not working.

i dont want to set it (backspace) as a hotkey, because that could mess other things up.

just want to have someone look at that code, and tell me if theres anything wrong with it.

i dont see anything wrong.

if backspace is pressed, and focus is on the second input box, and the second input box has no data, then go to the first input box.

thats what it says right there in code, yet it doesnt work. i think it might be the iskeypressed function? becuse i used a messagebox to test the other variables, and they were true to what i had them figured out as. $focus is Edit2 and $var2 is 0

so i dont know other than the keypressed function..

any ideas at all????? guys?

Edited by t0ddie

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...