Sign in to follow this  
Followers 0
Borje

I need some help with input

4 posts in this topic

#1 ·  Posted (edited)

I needed little help what to do with this input's what I want is when I entered some info in the input field and press enter I want to

jump to the next input field, same as when I press the tab button. I have test and try to find a solution but I find not a slution.

Please is that anobody can help me and perhaps give me an example what to do ??

Code:

#include <ButtonConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

$Form1 = GUICreate("Input dialog", 465, 343, 346, 262)

;GUISetBkColor (0x00E0FFFF)

GUISetIcon("D:\003.ico")

$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 449, 281)

GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateLabel("FirstName: ", 14, 75, 125, 25, 1)

GUICtrlSetFont(-1, 9, 400, 1, "verdana")

$Fornamn = GUICtrlCreateInput ( "", 112, 75, 125, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Aftername: ", 9, 110, 125, 25, 1)

GUICtrlSetFont(-1, 9, 400, 1, "Verdana")

$Efternamn = GUICtrlCreateInput ( "", 112, 110, 125, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Adres: ", 19, 150, 125, 25, 1)

GUICtrlSetFont(-1, 9, 400, 1, "verdana")

$Adress = GUICtrlCreateInput ( "", 112, 150, 225, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Cityname: ", 9, 190, 125, 25, 1)

GUICtrlSetFont(-1, 9, 400, 1, "verdana")

$Adress = GUICtrlCreateInput ( "", 112, 190, 225, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Email: ", 26, 230, 125, 25, 1)

GUICtrlSetFont(-1, 9, 400, 1, "verdana")

$Adress = GUICtrlCreateInput ( "", 112, 230, 225, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")

$Button1 = GUICtrlCreateButton("&Send", 113, 299, 75, 25)

GUICtrlSetFont(-1, 10, 400, 1, "verdana")

$Button2 = GUICtrlCreateButton("&Close", 290, 299, 75, 25)

GUICtrlSetFont(-1, 9, 400, 1, "verdana")

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

EndSwitch

WEnd

Exit

Edited by Borje

Share this post


Link to post
Share on other sites



Use a hidden button with the DefButton style that switches to the next?

$hGUI = GUICreate ("Testing input switching!", 200, 200)
   $hInp1 = GUICtrlCreateInput ("", 2, 2, 196, 20)
   $hInp2 = GUICtrlCreateInput ("", 2, 24, 196, 20)
   $hBtn =  GUICtrlCreateButton ("Hidden", -20, -20, 1, 1, 0x0001)

   GUISetstate ()

   While 1
      Switch GUIGetMsg ()
         Case -3
            Exit
         Case $hBtn
            $cur = ControlGetFocus ($hGUI, "")
            If $cur = "Edit1" Then
               ControlFocus ($hGUI, "", "Edit2")
            ElseIf $cur = "Edit2" Then
               ControlFocus ($hGUI, "", "Edit1")
            EndIf
      EndSwitch
   WEnd

Not particularly glamourous coding, but does the job efficiently

Mat

Share this post


Link to post
Share on other sites

Use GUICtrlSetState() to set the focus to the next control

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Input dialog", 465, 343, 346, 262)
;GUISetBkColor (0x00E0FFFF)

GUISetIcon("D:\003.ico")
$GroupBox1 = GUICtrlCreateGroup("", 8, 1, 449, 281)
GUICtrlCreateGroup("", -99, -99, 1, 1)

GUICtrlCreateLabel("FirstName: ", 14, 75, 125, 25, 1)
GUICtrlSetFont(-1, 9, 400, 1, "verdana")
$inpFornamn = GUICtrlCreateInput ( "", 112, 75, 125, 20)
GUICtrlSetFont(-1, 9, 300, 1, "verdana")
GUICtrlCreateLabel("Aftername: ", 9, 110, 125, 25, 1)
GUICtrlSetFont(-1, 9, 400, 1, "Verdana")
$inpEfternamn = GUICtrlCreateInput ( "", 112, 110, 125, 20)
GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Adress: ", 19, 150, 125, 25, 1)
GUICtrlSetFont(-1, 9, 400, 1, "verdana")
$inpAdress = GUICtrlCreateInput ( "", 112, 150, 225, 20)
GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Cityname: ", 9, 190, 125, 25, 1)
GUICtrlSetFont(-1, 9, 400, 1, "verdana")
$inpCityname = GUICtrlCreateInput ( "", 112, 190, 225, 20)
GUICtrlSetFont(-1, 9, 300, 1, "verdana")

GUICtrlCreateLabel("Email: ", 26, 230, 125, 25, 1)
GUICtrlSetFont(-1, 9, 400, 1, "verdana")
$inpEmail = GUICtrlCreateInput ( "", 112, 230, 225, 20)

GUICtrlSetFont(-1, 9, 300, 1, "verdana")


$btnSend = GUICtrlCreateButton("&Send", 113, 299, 75, 25)
GUICtrlSetFont(-1, 10, 400, 1, "verdana")
$btnClose = GUICtrlCreateButton("&Close", 290, 299, 75, 25)
GUICtrlSetFont(-1, 9, 400, 1, "verdana")
GUISetState(@SW_SHOW)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $inpFornamn
        GUICtrlSetState($inpEfternamn,$GUI_FOCUS)
    Case $inpEfternamn
        GUICtrlSetState($inpAdress,$GUI_FOCUS)
    Case $inpAdress
        GUICtrlSetState($inpCityname,$GUI_FOCUS)
    Case $inpCityname
        GUICtrlSetState($inpEmail,$GUI_FOCUS)
    Case $inpEmail
        GUICtrlSetState($btnSend,$GUI_FOCUS)
    Case $btnClose
        Exit
EndSwitch
WEnd
Exit

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

Hi Bowmore

I have checked your example and it works perfectly many many thanks for your

good example how to use GUICtrlSetState() to set the focus to the next control

Many many thanks again.

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