Jump to content

need help with list view please


salter
 Share

Recommended Posts

hey there im trying to make the script add watever is in the two input boxes at the bottom into the list box place that is selected

heres the code :

#include <GUIListView.au3>
#include <GUIConstants.au3>


#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\WalkToCoords.kxf
$Form1 = GUICreate("Walk To Coords", 219, 300, 193, 115)
$XC = GUICtrlCreateInput("", 40, 216, 33, 21)
$Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$YC = GUICtrlCreateInput("", 96, 216, 33, 21)
$Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, 0)
$CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER))
$CoordList_0 = GUICtrlCreateListViewItem("1||", $CoordList)
$CoordList_1 = GUICtrlCreateListViewItem("2||", $CoordList)
$CoordList_2 = GUICtrlCreateListViewItem("3||", $CoordList)
$CoordList_3 = GUICtrlCreateListViewItem("4||", $CoordList)
$CoordList_4 = GUICtrlCreateListViewItem("5||", $CoordList)
$CoordList_5 = GUICtrlCreateListViewItem("6||", $CoordList)
$CoordList_6 = GUICtrlCreateListViewItem("7||", $CoordList)
$CoordList_7 = GUICtrlCreateListViewItem("8||", $CoordList)
$CoordList_8 = GUICtrlCreateListViewItem("9||", $CoordList)
$CoordList_9 = GUICtrlCreateListViewItem("10||", $CoordList)
$CoordList_10 = GUICtrlCreateListViewItem("11||", $CoordList)
$CoordList_11 = GUICtrlCreateListViewItem("12||", $CoordList)
$CoordList_12 = GUICtrlCreateListViewItem("13||", $CoordList)
$CoordList_13 = GUICtrlCreateListViewItem("14||", $CoordList)
$CoordList_14 = GUICtrlCreateListViewItem("15||", $CoordList)
$CoordList_15 = GUICtrlCreateListViewItem("16||", $CoordList)
$CoordList_16 = GUICtrlCreateListViewItem("17||", $CoordList)
$CoordList_17 = GUICtrlCreateListViewItem("18||", $CoordList)
$CoordList_18 = GUICtrlCreateListViewItem("19||", $CoordList)
$CoordList_19 = GUICtrlCreateListViewItem("20||", $CoordList)
$CoordList_20 = GUICtrlCreateListViewItem("21||", $CoordList)
$CoordList_21 = GUICtrlCreateListViewItem("22||", $CoordList)
$CoordList_22 = GUICtrlCreateListViewItem("23||", $CoordList)
$CoordList_23 = GUICtrlCreateListViewItem("24||", $CoordList)
$CoordList_24 = GUICtrlCreateListViewItem("25||", $CoordList)
$CoordList_25 = GUICtrlCreateListViewItem("26||", $CoordList)
$CoordList_26 = GUICtrlCreateListViewItem("27||", $CoordList)
$CoordList_27 = GUICtrlCreateListViewItem("28||", $CoordList)
$CoordList_28 = GUICtrlCreateListViewItem("29||", $CoordList)
$CoordList_29 = GUICtrlCreateListViewItem("30||", $CoordList)
$CoordList_30 = GUICtrlCreateListViewItem("31||", $CoordList)
$CoordList_31 = GUICtrlCreateListViewItem("32||", $CoordList)
$CoordList_32 = GUICtrlCreateListViewItem("33||", $CoordList)
$CoordList_33 = GUICtrlCreateListViewItem("34||", $CoordList)
$CoordList_34 = GUICtrlCreateListViewItem("35||", $CoordList)
$CoordList_35 = GUICtrlCreateListViewItem("36||", $CoordList)
$CoordList_36 = GUICtrlCreateListViewItem("37||", $CoordList)
$CoordList_37 = GUICtrlCreateListViewItem("38||", $CoordList)
$CoordList_38 = GUICtrlCreateListViewItem("39||", $CoordList)
$CoordList_39 = GUICtrlCreateListViewItem("40||", $CoordList)
$CoordList_40 = GUICtrlCreateListViewItem("41||", $CoordList)
$CoordList_41 = GUICtrlCreateListViewItem("42||", $CoordList)
$CoordList_42 = GUICtrlCreateListViewItem("43||", $CoordList)
$CoordList_43 = GUICtrlCreateListViewItem("44||", $CoordList)
$CoordList_44 = GUICtrlCreateListViewItem("45||", $CoordList)
$CoordList_45 = GUICtrlCreateListViewItem("46||", $CoordList)
$CoordList_46 = GUICtrlCreateListViewItem("47||", $CoordList)
$CoordList_47 = GUICtrlCreateListViewItem("48||", $CoordList)
$CoordList_48 = GUICtrlCreateListViewItem("49||", $CoordList)
$CoordList_49 = GUICtrlCreateListViewItem("50||", $CoordList)
$Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0)
$Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0)
$OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0)
$WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
    Case $CoordList
    Case $Enter
        
; i want it to take the number from the $XC input box and the $YC input box and put it into the list
; when the person hits enter
        
        
    EndSwitch
WEnd

if anyone could help me out on how i could do this that would be great

Edited by salter
Link to comment
Share on other sites

holy mother jesus of god and all that is alot of work u did :P

#include <GUIListView.au3>
#include <GUIConstants.au3>

Global $CoordListItem[51]
#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\WalkToCoords.kxf
$Form1 = GUICreate("Walk To Coords", 219, 300, 193, 115)
$XC = GUICtrlCreateInput("", 40, 216, 33, 21)
$Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$YC = GUICtrlCreateInput("", 96, 216, 33, 21)
$Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, 0)
$CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER))
For $i = 1 To UBound($CoordListItem)-1
    $CoordListItem[$i] = GUICtrlCreateListViewItem($i & "||",$CoordList)
Next
$Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0)
$Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0)
$OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0)
$WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
    Case $CoordList
    Case $Enter
        If GUICtrlRead($XC) = "" Or GUICtrlRead($YC) = "" Then
                MsgBox(0,"Error","Fill In X & Y Inputs Please")
                Else
        GUICtrlSetData($CoordListItem[_GUICtrlListViewGetSelectedIndices($CoordList)+1],_GUICtrlListViewGetSelectedIndices($CoordList)+1 & "|" & GUICtrlRead($XC) & "|" & GUICtrlRead($YC))
        EndIf
        
        
    EndSwitch
WEnd
Link to comment
Share on other sites

maybe...

#include <GUIListView.au3>
#include <GUIConstants.au3>


#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\WalkToCoords.kxf
$Form1 = GUICreate("Walk To Coords", 219, 300, 193, 115)
$XC = GUICtrlCreateInput("", 40, 216, 33, 21)
$Label1 = GUICtrlCreateLabel("X", 24, 216, 12, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Y", 80, 216, 13, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$YC = GUICtrlCreateInput("", 96, 216, 33, 21)
$Enter = GUICtrlCreateButton("Enter", 136, 216, 59, 25, $BS_DEFPUSHBUTTON )
$CoordList = GUICtrlCreateListView("#|X|Y", 24, 40, 171, 163, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_BORDER))
$CoordList_0 = GUICtrlCreateListViewItem("1||", $CoordList)
$CoordList_1 = GUICtrlCreateListViewItem("2||", $CoordList)
$CoordList_2 = GUICtrlCreateListViewItem("3||", $CoordList)
$CoordList_3 = GUICtrlCreateListViewItem("4||", $CoordList)
$CoordList_4 = GUICtrlCreateListViewItem("5||", $CoordList)
$CoordList_5 = GUICtrlCreateListViewItem("6||", $CoordList)
$CoordList_6 = GUICtrlCreateListViewItem("7||", $CoordList)
$CoordList_7 = GUICtrlCreateListViewItem("8||", $CoordList)
$CoordList_8 = GUICtrlCreateListViewItem("9||", $CoordList)
$CoordList_9 = GUICtrlCreateListViewItem("10||", $CoordList)
$CoordList_10 = GUICtrlCreateListViewItem("11||", $CoordList)
$CoordList_11 = GUICtrlCreateListViewItem("12||", $CoordList)
$CoordList_12 = GUICtrlCreateListViewItem("13||", $CoordList)
$CoordList_13 = GUICtrlCreateListViewItem("14||", $CoordList)
$CoordList_14 = GUICtrlCreateListViewItem("15||", $CoordList)
$CoordList_15 = GUICtrlCreateListViewItem("16||", $CoordList)
$CoordList_16 = GUICtrlCreateListViewItem("17||", $CoordList)
$CoordList_17 = GUICtrlCreateListViewItem("18||", $CoordList)
$CoordList_18 = GUICtrlCreateListViewItem("19||", $CoordList)
$CoordList_19 = GUICtrlCreateListViewItem("20||", $CoordList)
$CoordList_20 = GUICtrlCreateListViewItem("21||", $CoordList)
$CoordList_21 = GUICtrlCreateListViewItem("22||", $CoordList)
$CoordList_22 = GUICtrlCreateListViewItem("23||", $CoordList)
$CoordList_23 = GUICtrlCreateListViewItem("24||", $CoordList)
$CoordList_24 = GUICtrlCreateListViewItem("25||", $CoordList)
$CoordList_25 = GUICtrlCreateListViewItem("26||", $CoordList)
$CoordList_26 = GUICtrlCreateListViewItem("27||", $CoordList)
$CoordList_27 = GUICtrlCreateListViewItem("28||", $CoordList)
$CoordList_28 = GUICtrlCreateListViewItem("29||", $CoordList)
$CoordList_29 = GUICtrlCreateListViewItem("30||", $CoordList)
$CoordList_30 = GUICtrlCreateListViewItem("31||", $CoordList)
$CoordList_31 = GUICtrlCreateListViewItem("32||", $CoordList)
$CoordList_32 = GUICtrlCreateListViewItem("33||", $CoordList)
$CoordList_33 = GUICtrlCreateListViewItem("34||", $CoordList)
$CoordList_34 = GUICtrlCreateListViewItem("35||", $CoordList)
$CoordList_35 = GUICtrlCreateListViewItem("36||", $CoordList)
$CoordList_36 = GUICtrlCreateListViewItem("37||", $CoordList)
$CoordList_37 = GUICtrlCreateListViewItem("38||", $CoordList)
$CoordList_38 = GUICtrlCreateListViewItem("39||", $CoordList)
$CoordList_39 = GUICtrlCreateListViewItem("40||", $CoordList)
$CoordList_40 = GUICtrlCreateListViewItem("41||", $CoordList)
$CoordList_41 = GUICtrlCreateListViewItem("42||", $CoordList)
$CoordList_42 = GUICtrlCreateListViewItem("43||", $CoordList)
$CoordList_43 = GUICtrlCreateListViewItem("44||", $CoordList)
$CoordList_44 = GUICtrlCreateListViewItem("45||", $CoordList)
$CoordList_45 = GUICtrlCreateListViewItem("46||", $CoordList)
$CoordList_46 = GUICtrlCreateListViewItem("47||", $CoordList)
$CoordList_47 = GUICtrlCreateListViewItem("48||", $CoordList)
$CoordList_48 = GUICtrlCreateListViewItem("49||", $CoordList)
$CoordList_49 = GUICtrlCreateListViewItem("50||", $CoordList)
$Save = GUICtrlCreateButton("Save", 16, 256, 59, 25, 0)
$Load = GUICtrlCreateButton("Load", 88, 256, 51, 25, 0)
$OK = GUICtrlCreateButton("OK", 152, 256, 51, 25, 0)
$WalkToName = GUICtrlCreateInput("", 24, 8, 169, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
    Case $CoordList
    Case $Enter
        $Xinfo = GUICtrlRead($XC)
        $Yinfo = GUICtrlRead($YC)
        $Rlist = GUICtrlRead($CoordList)
        $Nlist = _GUICtrlListViewGetCurSel ($CoordList) + 1
        GUICtrlSetData ( $Rlist, $Nlist & "|" & $Xinfo & "|" & $Yinfo)

        
        
; i want it to take the number from the $XC input box and the $YC input box and put it into the list
; when the person hits enter
        
        
    EndSwitch
WEnd

thatsgreat has a good idea for display and actually used the controls made for listviews

For $i = 1 To UBound($CoordListItem)-1

$CoordListItem[$i] = GUICtrlCreateListViewItem($i & "||",$CoordList)

Next

is how i would do it also

8)

Edited by Valuater

NEWHeader1.png

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