Jump to content
Sign in to follow this  
YunusEmre

How shall enter Input

Recommended Posts

YunusEmre

Hi all :)

How I want the enter key to activate thanks

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
Global $IniDir = @ScriptDir & "\Trial.ini"
If Not FileExists($IniDir) Then FileOpen($IniDir, 1)
$Form1_1 = GUICreate("Notes record", 491, 224)
$Input1x = GUICtrlCreateInput("", 8, 8, 369, 21)
$addbutton = GUICtrlCreateButton("Add", 391, 6, 91, 29)
$List1 = GUICtrlCreateList("", 8, 40, 473, 175)
GUISetState(@SW_SHOW)
_IniRead_ListAdd()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $addbutton
            $Input_Read = GUICtrlRead($Input1x)
            If Not StringInStr($Input_Read, "|") And $Input_Read <> "" Then
                GUICtrlSetData($Input1x, "")
                IniWrite($IniDir, "Notes", "1", IniRead($IniDir, "Notes", "1", "") & $Input_Read & "|")
                _IniRead_ListAdd()
            Else
                MsgBox(0, "", "Please '|' Do not use karakrer." & @CRLF & "Input to write something!")
            EndIf
    EndSwitch
WEnd

Func _IniRead_ListAdd()
    Local $Ini_Read = IniRead($IniDir, "Notes", "1", "")
    ConsoleWrite($Ini_Read & @CRLF)
    Local $IniRead_Split = StringSplit($Ini_Read, "| & @CRLF")
    GUICtrlSetData($List1, "")
    For $i = 1 To $IniRead_Split[0]
        If $IniRead_Split[$i] <> "" Then GUICtrlSetData($List1, $IniRead_Split[$i])
    Next
EndFunc

Share this post


Link to post
Share on other sites
Melba23

YunusEmre,

Welcome to the AutoIt forums. :)

I would add an Accelerator key to do this. Look for the <<<<<<<<<<<<< lines: ;)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>

Global $IniDir = @ScriptDir & "\Trial.ini"

$Form1_1 = GUICreate("Notes record", 491, 224)
$Input1x = GUICtrlCreateInput("", 8, 8, 369, 21)
$addbutton = GUICtrlCreateButton("Add", 391, 6, 91, 29)
$List1 = GUICtrlCreateList("", 8, 40, 473, 175)

; Create a dummy control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$idDummy = GUICtrlCreateDummy()

GUISetState(@SW_SHOW)

; Set ENTER to fire the dummy control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Local $aAccelKeys[1][2] = [["{ENTER}", $idDummy]]
GUISetAccelerators($aAccelKeys)

_IniRead_ListAdd()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idDummy
            ; If the dummy was fired, check if the input has focus <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            If _WinAPI_GetFocus() = GUICtrlGetHandle($Input1x) Then
                ; If it does, then continue with the code for $addbutton <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                ContinueCase
            EndIf
        Case $addbutton
            $Input_Read = GUICtrlRead($Input1x)
            If Not StringInStr($Input_Read, "|") And $Input_Read <> "" Then
                GUICtrlSetData($Input1x, "")
                IniWrite($IniDir, "Notes", "1", IniRead($IniDir, "Notes", "1", "") & $Input_Read & "|")
                _IniRead_ListAdd()
            Else
                MsgBox(0, "", "Please '|' Do not use karakrer." & @CRLF & "Input to write something!")
            EndIf
    EndSwitch
WEnd

Func _IniRead_ListAdd()
    Local $Ini_Read = IniRead($IniDir, "Notes", "1", "")
    ConsoleWrite($Ini_Read & @CRLF)
    Local $IniRead_Split = StringSplit($Ini_Read, "| & @CRLF")
    GUICtrlSetData($List1, "")
    For $i = 1 To $IniRead_Split[0]
        If $IniRead_Split[$i] <> "" Then GUICtrlSetData($List1, $IniRead_Split[$i])
    Next
EndFunc   ;==>_IniRead_ListAdd
Please ask if you have any questions. :)

M23

  • Like 1

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
YunusEmre

Thank you @Melba23
How to .ini A hundred get to the bottom line after the character

sample

[Notes]
1=123|456789|...100
2=123|456789|...100

Share this post


Link to post
Share on other sites
Melba23

YunusEmre,

Sorry, I do not understand the question. :(

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
YunusEmre

ini file in the next post to go to the bottom line? :(

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  

×