Jump to content

save to listbox with arrray and search


deve
 Share

Recommended Posts

Here a newbie just finished the GUI for a project that whill help all pigenon owners. There is no such a tool so I thought to create the functions we need, well coding part is a ask from me to you iif anyone have time to help with it. It is simple actually , I have 6 input text , 1 picture add, 1 editbox and one combobox , this fields needs to be filled from the user and when user clicks on save it should save the data to a text file or ini ?? then it should show only 1combobox selection and 6 inputbox edits  in the Editbox1 . This editbox1 with the saved data should be clickable so when clicked a new form pops up with the all entry the user saved . ( GUI has image that user should be able to click and add his picture )

 

HEre the GUI I finished :

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Global $userspath = "Users.txt"
#Region ### START Koda GUI section ### Form=c:\users\deve\downloads\koda_1.7.3.0\forms\kumesim.kxf
$Kumesim = GUICreate("Kumesim", 1000, 507, 185, 106)
$Dosya = GUICtrlCreateMenu("&Menu")
$MenuItem2 = GUICtrlCreateMenuItem("Hakkında", $Dosya)
$MenuItem1 = GUICtrlCreateMenuItem("Çıkış", $Dosya)
GUISetFont(8, 400, 0, "Courier New")
$Cinsi = GUICtrlCreateInput("Cinsi", 696, 56, 121, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Renk = GUICtrlCreateInput("Renk", 824, 88, 129, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Dogum = GUICtrlCreateInput("Dogum", 824, 56, 129, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Anne = GUICtrlCreateInput("Anne", 696, 120, 121, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Baba = GUICtrlCreateInput("Baba", 824, 120, 129, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Notlar = GUICtrlCreateEdit("", 696, 280, 265, 145)
GUICtrlSetData(-1, "Notlar")
GUICtrlSetColor(-1, 0x3399FF)
$Kunye = GUICtrlCreateInput("Kunye", 696, 88, 121, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Pic1 = GUICtrlCreatePic("C:\Users\deve\Downloads\posta.jpg", 776, 168, 113, 81)
$Kaydet = GUICtrlCreateButton("Kaydet", 888, 432, 75, 25)
GUICtrlSetColor(-1, 0x3399FF)
$Input1 = GUICtrlCreateInput("Kus ara", 32, 64, 241, 22)
GUICtrlSetColor(-1, 0x3399FF)
$Ara = GUICtrlCreateButton("Ara", 472, 64, 75, 22)
GUICtrlSetFont(-1, 12, 400, 0, "Courier New")
GUICtrlSetColor(-1, 0x3399FF)
$Guvercin_Detaylari = GUICtrlCreateGroup("Guvercin_Detaylari", 672, 24, 313, 441)
GUICtrlSetFont(-1, 10, 400, 0, "Courier New")
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Resim = GUICtrlCreateGroup("Resim", 704, 152, 249, 113)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo2 = GUICtrlCreateCombo("Combo2", 704, 432, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Combo2, "Item 2|Item 3", "Item 2")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Combo1 = GUICtrlCreateCombo("Combo1", 296, 64, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData($Combo1, "Item 2|Item 3", "Item 2")
GUICtrlSetColor(-1, 0x3399FF)
$Kus_Arama = GUICtrlCreateGroup("Kus_Arama", 16, 32, 633, 73)
GUICtrlSetFont(-1, 12, 400, 0, "Courier New")
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Local $List1 = GUICtrlCreateListView("Durumu|Künye|Cinsi|Doğum Yılı|Renk|Resim", 16, 128, 641, 342)
Local $Item1 = GUICtrlCreateListViewItem("", $List1)
GUISetBkColor(0x00E0FFFF) ;
GUICtrlSetColor(-1, 0x3399FF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
;this function is not that I wont not working :(
_Fill_List()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Kaydet
            ; Read the input
            $readwrite = GUICtrlRead($Baba, "")
            GUICtrlSetData($Item1, $readwrite)
            ; Add the name to the file
            FileWriteLine($userspath, $readwrite)
    EndSwitch
WEnd

Func _Fill_List()

    ; Read the file into an array
    Local $array
    _FileReadToArray($userspath, $array)
    ; Check we read something
    If IsArray($array) Then
        ; Convert to a string with delimiters
        $sList = ""
        For $i = 1 To $array[0]
            $sList &= "|" & $array[$i]
        Next
        ; And fill the list
        GUICtrlSetData($List1, $sList)
    EndIf

EndFunc

 

Second GUI here :

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Guvercin_Bilgileri = GUICreate("Güvercin Bilgileri", 835, 456, 187, 122)
GUISetFont(10, 400, 0, "Courier New")
$Pic1 = GUICtrlCreatePic("", 16, 24, 401, 393)
$Input1 = GUICtrlCreateInput("", 672, 24, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label1 = GUICtrlCreateLabel("Durum", 480, 32, 44, 20)
$Dogum_Tarihi = GUICtrlCreateLabel("Doğum Tarihi", 480, 62, 100, 20)
$Input2 = GUICtrlCreateInput("", 672, 54, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Renk = GUICtrlCreateLabel("Renk", 480, 92, 36, 20)
$Input3 = GUICtrlCreateInput("", 672, 84, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Kunye = GUICtrlCreateLabel("Künye", 480, 122, 44, 20)
$Input4 = GUICtrlCreateInput("", 672, 114, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Anne = GUICtrlCreateLabel("Anne", 480, 152, 36, 20)
$Baba = GUICtrlCreateLabel("Baba", 480, 182, 36, 20)
$Input5 = GUICtrlCreateInput("", 672, 144, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input6 = GUICtrlCreateInput("", 672, 174, 121, 24)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateEdit("hiç not yok bu kuş için", 432, 216, 385, 217)
GUICtrlSetState(-1, $GUI_DISABLE)
$Genel_Bilgiler = GUICtrlCreateGroup("Genel Bilgiler", 432, 8, 385, 201)
GUICtrlSetColor(-1, 0x3399FF)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Resim = GUICtrlCreateGroup("Resim", 16, 8, 401, 425)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

    EndSwitch
WEnd

thanks in advance and soory my english

Edited by deve
forgot details
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...