Jump to content

Saving This.........


Aceguy
 Share

Recommended Posts

Cant Figure out how to save the data in the list.

#include <GUIConstants.au3>





dim $IniFile = @DesktopDir & "\recipies.ini"

    
$myGui=GUICreate("Test Prg v1.0",400,500)
$Add=GUICtrlCreateButton("Add Inputs",10,450,75,25)   
$save=GUICtrlCreateButton("Save",200,450,75,25)

$Input_1=GUICtrlCreateInput("input1",10,420,50,25)
$Input_2=GUICtrlCreateInput("input2",70,420,50,25)
$Input_3=GUICtrlCreateInput("input4",130,420,50,25)
$Input_4=GUICtrlCreateInput("input4",190,420,50,25)

$listview = GUICtrlCreateListView("Input1|Input2|Input3|Input4|", 10, 10, 380, 350)

$inientry = IniReadSection($IniFile, "yagudo drink")
    
  
    If Not IsArray($inientry) Then
        MsgBox(0, "", "No Entry")
    Else
       
        For $i = 1 To $inientry[0][0]
            GUICtrlCreateListViewItem($inientry[$i][1], $listview)
        Next
    EndIf   

   

    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $Add
                $read1=GUICtrlRead($Input_1)
                $read2=GUICtrlRead($Input_2)
                $read3=GUICtrlRead($Input_3)
                $read4=GUICtrlRead($Input_4)
                
                GuiCtrlCreateListViewItem($read1 & "|" & $read2 & "|" & $read3 & "|" & $read4 & "|", $listView)
        case $msg = -3
            ExitLoop
         

Case $msg = $save
        

        EndSelect
    WEnd

Please Help, many thanks.

Link to comment
Share on other sites

  • Moderators

LOL... :P we don't have the list to check

Edit:.... I'm feeling like an :D today... hope you didn't read what I posted before :D

The list items are stored in the $inientry array, and to read a list view you would need to use the _GUICtrlListViewGetItemTextArray() or something to store the items in an array... I don't play with this function enough to give you "good" answer, sorry.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

as Smoke said with out the file to reference the key names it's just a guess

#include <GUIConstants.au3>
#include <GuiListView.au3>

Dim $IniFile = @DesktopDir & "\recipies.ini"

$myGui = GUICreate("Test Prg v1.0", 400, 500)
$Add = GUICtrlCreateButton("Add Inputs", 10, 450, 75, 25)
$save = GUICtrlCreateButton("Save", 200, 450, 75, 25)

$Input_1 = GUICtrlCreateInput("input1", 10, 420, 50, 25)
$Input_2 = GUICtrlCreateInput("input2", 70, 420, 50, 25)
$Input_3 = GUICtrlCreateInput("input4", 130, 420, 50, 25)
$Input_4 = GUICtrlCreateInput("input4", 190, 420, 50, 25)

$listview = GUICtrlCreateListView("Input1|Input2|Input3|Input4|", 10, 10, 380, 350)

$inientry = IniReadSection($IniFile, "yagudo drink")

If Not IsArray($inientry) Then
    MsgBox(0, "", "No Entry")
Else
    
    For $i = 1 To $inientry[0][0]
        GUICtrlCreateListViewItem($inientry[$i][1], $listview)
    Next
EndIf

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Add
            $read1 = GUICtrlRead($Input_1)
            $read2 = GUICtrlRead($Input_2)
            $read3 = GUICtrlRead($Input_3)
            $read4 = GUICtrlRead($Input_4)
            
            GUICtrlCreateListViewItem($read1 & "|" & $read2 & "|" & $read3 & "|" & $read4 & "|", $listview)
        Case $msg = -3
            ExitLoop
            
            
        Case $msg = $save
            For $x = 0 To _GUICtrlListViewGetItemCount($listview) - 1
                IniWrite($IniFile, "yagudo drink", $x, _GUICtrlListViewGetItemText($listview, $x))
            Next
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...