Sign in to follow this  
Followers 0
madmorgan

help with building GUI keybord

4 posts in this topic

hello all again,

im building a GUI key bord for a tuch screen system and i can make all the keys work but one the DELETE key.

if the user types some text in to the edit box and they spell it wrong i want them to use the delete key to remove letter or text they have typed with it.

here is my code so far.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
;TOP ROW NUMBERS WITH DELETE KEY
$Form1_1 = GUICreate("Form1", 808, 445, 171, 130)
$Button1 = GUICtrlCreateButton("1", 56, 88, 52, 25)
$Button2 = GUICtrlCreateButton("2", 104, 88, 51, 25)
$Button3 = GUICtrlCreateButton("3", 152, 88, 51, 25)
$Button4 = GUICtrlCreateButton("4", 200, 88, 51, 25)
$Button5 = GUICtrlCreateButton("5", 248, 88, 51, 25)
$Button6 = GUICtrlCreateButton("6", 296, 88, 51, 25)
$Button7 = GUICtrlCreateButton("7", 344, 88, 51, 25)
$Button8 = GUICtrlCreateButton("8", 392, 88, 51, 25)
$Button9 = GUICtrlCreateButton("9", 440, 88, 51, 25)
$Button10 = GUICtrlCreateButton("0", 488, 88, 51, 25)
$Button11 = GUICtrlCreateButton("-", 536, 88, 51, 25)
$Button12 = GUICtrlCreateButton("+", 584, 88, 51, 25)
$Button27 = GUICtrlCreateButton("DELETE", 632, 88, 115, 25)

;SECOUND ROW
$Button14 = GUICtrlCreateButton("TAB", 8, 112, 75, 25)
$Button15 = GUICtrlCreateButton("Q", 80, 112, 51, 25)
$Button16 = GUICtrlCreateButton("W", 128, 112, 51, 25)
$Button17 = GUICtrlCreateButton("E", 176, 112, 51, 25)
$Button18 = GUICtrlCreateButton("R", 224, 112, 51, 25)
$Button19 = GUICtrlCreateButton("T", 272, 112, 51, 25)
$Button20 = GUICtrlCreateButton("Y", 320, 112, 51, 25)
$Button21 = GUICtrlCreateButton("U", 368, 112, 51, 25)
$Button22 = GUICtrlCreateButton("I", 416, 112, 51, 25)
$Button23 = GUICtrlCreateButton("O", 464, 112, 51, 25)
$Button24 = GUICtrlCreateButton("P", 512, 112, 51, 25)
$Button25 = GUICtrlCreateButton("[", 560, 112, 51, 25)
$Button26 = GUICtrlCreateButton("]", 608, 112, 51, 25)

;THURD ROW
$Button28 = GUICtrlCreateButton("CAPSLOCK", 8, 136, 91, 25)
$Button29 = GUICtrlCreateButton("A", 96, 136, 51, 25)
$Button30 = GUICtrlCreateButton("S", 144, 136, 51, 25)
$Button31 = GUICtrlCreateButton("D", 192, 136, 51, 25)
$Button32 = GUICtrlCreateButton("F", 240, 136, 51, 25)
$Button33 = GUICtrlCreateButton("G", 288, 136, 51, 25)
$Button34 = GUICtrlCreateButton("H", 336, 136, 51, 25)
$Button35 = GUICtrlCreateButton("J", 384, 136, 51, 25)
$Button36 = GUICtrlCreateButton("K", 432, 136, 51, 25)
$Button37 = GUICtrlCreateButton("L", 480, 136, 51, 25)
$Button38 = GUICtrlCreateButton(";", 528, 136, 51, 25)
$Button39 = GUICtrlCreateButton("'", 576, 136, 51, 25)
$Button40 = GUICtrlCreateButton("#", 624, 136, 51, 25)

;FORTH ROW
$Button42 = GUICtrlCreateButton("SHIFT", 8, 160, 67, 25)
$Button43 = GUICtrlCreateButton("\", 72, 160, 51, 25)
$Button44 = GUICtrlCreateButton("Z", 120, 160, 51, 25)
$Button45 = GUICtrlCreateButton("X", 168, 160, 51, 25)
$Button46 = GUICtrlCreateButton("C", 216, 160, 51, 25)
$Button47 = GUICtrlCreateButton("V", 264, 160, 51, 25)
$Button48 = GUICtrlCreateButton("B", 312, 160, 51, 25)
$Button49 = GUICtrlCreateButton("N", 360, 160, 51, 25)
$Button50 = GUICtrlCreateButton("M", 408, 160, 51, 25)
$Button51 = GUICtrlCreateButton(",", 456, 160, 51, 25)
$Button52 = GUICtrlCreateButton(".", 504, 160, 51, 25)
$Button53 = GUICtrlCreateButton("/", 552, 160, 51, 25)
$Button54 = GUICtrlCreateButton("SHIFT", 600, 160, 147, 25)

;OTHER KEYS
$Button13 = GUICtrlCreateButton("", 8, 88, 51, 25);BLANK SPACE KEY
$Button41 = GUICtrlCreateButton("ENTER", 672, 112, 75, 49)
$Button55 = GUICtrlCreateButton("SPACE BAR", 200, 184, 275, 25)

$Edit1 = GUICtrlCreateEdit("", 104, 304, 585, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            ;ROW 1 __NUMBERS & DELETE KEY
        case $Button1
            _TEXT($Edit1, 1)
        Case $Button2
            _TEXT($Edit1, 2)
        Case $Button3
            _TEXT($Edit1, 3)
        case $Button4
            _TEXT($Edit1, 4)
        Case $Button5
            _TEXT($Edit1, 5)
        Case $Button6
            _TEXT($Edit1, 6)
        Case $Button7
            _TEXT($Edit1, 7)
        Case $Button8
            _TEXT($Edit1, 8)
        Case $Button9
            _TEXT($Edit1, 9)
        Case $Button10
            _TEXT($Edit1, 0)
        Case $Button11
            _TEXT($Edit1, "-")
        Case $Button12
            _TEXT($Edit1, "+")
        Case $Button27
            _TEXT($Edit1, "DELETE")

        ;ROW 2 __ TAB to ]
        Case $Button14
            _TEXT($Edit1, "TAB")
        case $Button15
            _TEXT($Edit1, "Q")
        Case $Button16
            _TEXT($Edit1, "W")
        Case $Button17
            _TEXT($Edit1, "E")
        Case $Button18
            _TEXT($Edit1, "R")
        Case $Button19
            _TEXT($Edit1, "T")
        Case $Button20
            _TEXT($Edit1, "Y")
        Case $Button21
            _TEXT($Edit1, "U")
        Case $Button22
            _TEXT($Edit1, "I")
        case $Button23
            _TEXT($Edit1, "O")
        case $Button24
            _TEXT($Edit1, "P")
        case $Button25
            _TEXT($Edit1, "[")
        case $Button26
            _TEXT($Edit1, "]")

            ;ROW 3 __ CAPSLOCK to #
        case $Button28
            _TEXT($Edit1, "CAPSLOCK")
        Case $Button29
            _TEXT($Edit1, "A")
        Case $Button30
            _TEXT($Edit1, "S")
        Case $Button31
            _TEXT($Edit1, "D")
        Case $Button32
            _TEXT($Edit1, "F")
        case $Button33
            _TEXT($Edit1, "G")
        Case $Button34
            _TEXT($Edit1, "H")
        case $Button35
            _TEXT($Edit1, "J")
        Case $Button36
            _TEXT($Edit1, "K")
        case $Button37
            _TEXT($Edit1, "L")
        Case $Button38
            _TEXT($Edit1, ";")
        Case $Button39
            _TEXT($Edit1, "'")
        Case $Button40
            _TEXT($Edit1, "#")

            ;ROW 4 __ SHIFT to SHIFT
        Case $Button42
            _TEXT($Edit1, "SHIFT")
        Case $Button43
            _TEXT($Edit1, "\")
        Case $Button44
            _TEXT($Edit1, "Z")
        Case $Button45
            _TEXT($Edit1, "X")
        Case $Button46
            _TEXT($Edit1, "C")
        Case $Button47
            _TEXT($Edit1, "V")
        Case $Button48
            _TEXT($Edit1, "B")
        Case $Button49
            _TEXT($Edit1, "N")
        Case $Button50
            _TEXT($Edit1, "M")
        Case $Button51
            _TEXT($Edit1, ",")
        Case $Button52
            _TEXT($Edit1, ".")
        Case $Button53
            _TEXT($Edit1, "/")
        Case $Button54
            _TEXT($Edit1, "SHIFT")
            ;OTHER KEYS
        Case $Button41 ;ENTER
            _TEXT($Edit1, @CRLF)
        case $Button55
            _TEXT($Edit1, " ")

    EndSwitch
WEnd


Func _TEXT(ByRef $object, $letter)
    GUICtrlSetData($Edit1, $letter, 1)
EndFunc

Share this post


Link to post
Share on other sites



Would something like this do the job?

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
;TOP ROW NUMBERS WITH DELETE KEY
$Form1_1 = GUICreate("Form1", 808, 445, 171, 130)
$Button1 = GUICtrlCreateButton("1", 56, 88, 52, 25)
$Button2 = GUICtrlCreateButton("2", 104, 88, 51, 25)
$Button3 = GUICtrlCreateButton("3", 152, 88, 51, 25)
$Button4 = GUICtrlCreateButton("4", 200, 88, 51, 25)
$Button5 = GUICtrlCreateButton("5", 248, 88, 51, 25)
$Button6 = GUICtrlCreateButton("6", 296, 88, 51, 25)
$Button7 = GUICtrlCreateButton("7", 344, 88, 51, 25)
$Button8 = GUICtrlCreateButton("8", 392, 88, 51, 25)
$Button9 = GUICtrlCreateButton("9", 440, 88, 51, 25)
$Button10 = GUICtrlCreateButton("0", 488, 88, 51, 25)
$Button11 = GUICtrlCreateButton("-", 536, 88, 51, 25)
$Button12 = GUICtrlCreateButton("+", 584, 88, 51, 25)
$Button27 = GUICtrlCreateButton("DELETE", 632, 88, 115, 25)

;SECOUND ROW
$Button14 = GUICtrlCreateButton("TAB", 8, 112, 75, 25)
$Button15 = GUICtrlCreateButton("Q", 80, 112, 51, 25)
$Button16 = GUICtrlCreateButton("W", 128, 112, 51, 25)
$Button17 = GUICtrlCreateButton("E", 176, 112, 51, 25)
$Button18 = GUICtrlCreateButton("R", 224, 112, 51, 25)
$Button19 = GUICtrlCreateButton("T", 272, 112, 51, 25)
$Button20 = GUICtrlCreateButton("Y", 320, 112, 51, 25)
$Button21 = GUICtrlCreateButton("U", 368, 112, 51, 25)
$Button22 = GUICtrlCreateButton("I", 416, 112, 51, 25)
$Button23 = GUICtrlCreateButton("O", 464, 112, 51, 25)
$Button24 = GUICtrlCreateButton("P", 512, 112, 51, 25)
$Button25 = GUICtrlCreateButton("[", 560, 112, 51, 25)
$Button26 = GUICtrlCreateButton("]", 608, 112, 51, 25)

;THURD ROW
$Button28 = GUICtrlCreateButton("CAPSLOCK", 8, 136, 91, 25)
$Button29 = GUICtrlCreateButton("A", 96, 136, 51, 25)
$Button30 = GUICtrlCreateButton("S", 144, 136, 51, 25)
$Button31 = GUICtrlCreateButton("D", 192, 136, 51, 25)
$Button32 = GUICtrlCreateButton("F", 240, 136, 51, 25)
$Button33 = GUICtrlCreateButton("G", 288, 136, 51, 25)
$Button34 = GUICtrlCreateButton("H", 336, 136, 51, 25)
$Button35 = GUICtrlCreateButton("J", 384, 136, 51, 25)
$Button36 = GUICtrlCreateButton("K", 432, 136, 51, 25)
$Button37 = GUICtrlCreateButton("L", 480, 136, 51, 25)
$Button38 = GUICtrlCreateButton(";", 528, 136, 51, 25)
$Button39 = GUICtrlCreateButton("'", 576, 136, 51, 25)
$Button40 = GUICtrlCreateButton("#", 624, 136, 51, 25)

;FORTH ROW
$Button42 = GUICtrlCreateButton("SHIFT", 8, 160, 67, 25)
$Button43 = GUICtrlCreateButton("\", 72, 160, 51, 25)
$Button44 = GUICtrlCreateButton("Z", 120, 160, 51, 25)
$Button45 = GUICtrlCreateButton("X", 168, 160, 51, 25)
$Button46 = GUICtrlCreateButton("C", 216, 160, 51, 25)
$Button47 = GUICtrlCreateButton("V", 264, 160, 51, 25)
$Button48 = GUICtrlCreateButton("B", 312, 160, 51, 25)
$Button49 = GUICtrlCreateButton("N", 360, 160, 51, 25)
$Button50 = GUICtrlCreateButton("M", 408, 160, 51, 25)
$Button51 = GUICtrlCreateButton(",", 456, 160, 51, 25)
$Button52 = GUICtrlCreateButton(".", 504, 160, 51, 25)
$Button53 = GUICtrlCreateButton("/", 552, 160, 51, 25)
$Button54 = GUICtrlCreateButton("SHIFT", 600, 160, 147, 25)

;OTHER KEYS
$Button13 = GUICtrlCreateButton("", 8, 88, 51, 25);BLANK SPACE KEY
$Button41 = GUICtrlCreateButton("ENTER", 672, 112, 75, 49)
$Button55 = GUICtrlCreateButton("SPACE BAR", 200, 184, 275, 25)

$Edit1 = GUICtrlCreateEdit("", 104, 304, 585, 89)
GUICtrlSetData(-1, "")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

            ;ROW 1 __NUMBERS & DELETE KEY
        case $Button1
            _TEXT($Edit1, 1)
        Case $Button2
            _TEXT($Edit1, 2)
        Case $Button3
            _TEXT($Edit1, 3)
        case $Button4
            _TEXT($Edit1, 4)
        Case $Button5
            _TEXT($Edit1, 5)
        Case $Button6
            _TEXT($Edit1, 6)
        Case $Button7
            _TEXT($Edit1, 7)
        Case $Button8
            _TEXT($Edit1, 8)
        Case $Button9
            _TEXT($Edit1, 9)
        Case $Button10
            _TEXT($Edit1, 0)
        Case $Button11
            _TEXT($Edit1, "-")
        Case $Button12
            _TEXT($Edit1, "+")
        Case $Button27
            GUICtrlSetData($Edit1,StringTrimRight(GuiCtrlRead($Edit1),1))

        ;ROW 2 __ TAB to ]
        Case $Button14
            _TEXT($Edit1, "TAB")
        case $Button15
            _TEXT($Edit1, "Q")
        Case $Button16
            _TEXT($Edit1, "W")
        Case $Button17
            _TEXT($Edit1, "E")
        Case $Button18
            _TEXT($Edit1, "R")
        Case $Button19
            _TEXT($Edit1, "T")
        Case $Button20
            _TEXT($Edit1, "Y")
        Case $Button21
            _TEXT($Edit1, "U")
        Case $Button22
            _TEXT($Edit1, "I")
        case $Button23
            _TEXT($Edit1, "O")
        case $Button24
            _TEXT($Edit1, "P")
        case $Button25
            _TEXT($Edit1, "[")
        case $Button26
            _TEXT($Edit1, "]")

            ;ROW 3 __ CAPSLOCK to #
        case $Button28
            _TEXT($Edit1, "CAPSLOCK")
        Case $Button29
            _TEXT($Edit1, "A")
        Case $Button30
            _TEXT($Edit1, "S")
        Case $Button31
            _TEXT($Edit1, "D")
        Case $Button32
            _TEXT($Edit1, "F")
        case $Button33
            _TEXT($Edit1, "G")
        Case $Button34
            _TEXT($Edit1, "H")
        case $Button35
            _TEXT($Edit1, "J")
        Case $Button36
            _TEXT($Edit1, "K")
        case $Button37
            _TEXT($Edit1, "L")
        Case $Button38
            _TEXT($Edit1, ";")
        Case $Button39
            _TEXT($Edit1, "'")
        Case $Button40
            _TEXT($Edit1, "#")

            ;ROW 4 __ SHIFT to SHIFT
        Case $Button42
            _TEXT($Edit1, "SHIFT")
        Case $Button43
            _TEXT($Edit1, "\")
        Case $Button44
            _TEXT($Edit1, "Z")
        Case $Button45
            _TEXT($Edit1, "X")
        Case $Button46
            _TEXT($Edit1, "C")
        Case $Button47
            _TEXT($Edit1, "V")
        Case $Button48
            _TEXT($Edit1, "B")
        Case $Button49
            _TEXT($Edit1, "N")
        Case $Button50
            _TEXT($Edit1, "M")
        Case $Button51
            _TEXT($Edit1, ",")
        Case $Button52
            _TEXT($Edit1, ".")
        Case $Button53
            _TEXT($Edit1, "/")
        Case $Button54
            _TEXT($Edit1, "SHIFT")
            ;OTHER KEYS
        Case $Button41 ;ENTER
            _TEXT($Edit1, @CRLF)
        case $Button55
            _TEXT($Edit1, " ")

    EndSwitch
WEnd


Func _TEXT(ByRef $object, $letter)
    GUICtrlSetData($Edit1, $letter, 1)
EndFunc

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

wow cool thanks i just wish i know how do do these tricks but i guess it will come with time but thanks

Share this post


Link to post
Share on other sites

wow cool thanks i just wish i know how do do these tricks but i guess it will come with time but thanks

It is actually quite simple. Here is the code split into mutliple lines so it can be more easily understood.

$Read=GuiCtrlRead($Edit1);Read the data from the control
$Read=StringTrimRight($Read,1) ;Remove the rightmost character
GUICtrlSetData($Edit1,$Read);Assign the new data

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

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