Jump to content

Creating a Variable List...


Recommended Posts

Okay, so here's my issue:

I need to be able to file things into a list.

I have two origins, say Building "A" and Building "B". I am in Building "C" and my job is to sort the items from A and B into their respective lists. Problem is, sometimes there might be 20 from Building "A" and only 5 from Building "B". I can't just do a simple "If Then" statement becauxse it wouldn't list them.

I need to be able to look at each incoming item and check if it's A, or B, then Assign it a number for that list. For instance: say I have 5 "B" items already in the "B" list, and I get another "B" Item.. I need to put that into the "B" list and have it named "B-6" for later reference.

I know it's a vague metaphor, but I don't really know another way to explain it.

Basically, I need to create an Array of two groups (GroupA[$i] & GroupB[$i]) and have them there for later reference.

Almost like having 8 rooms and each day different people stay in the rooms, but I can reference the items by room number.... If that makes sence.

Edited by ericnail
Link to comment
Share on other sites

Okay, so here's my issue:

I need to be able to file things into a list.

I have two origins, say Building "A" and Building "B". I am in Building "C" and my job is to sort the items from A and B into their respective lists. Problem is, sometimes there might be 20 from Building "A" and only 5 from Building "B". I can't just do a simple "If Then" statement becauxse it wouldn't list them.

I need to be able to look at each incoming item and check if it's A, or B, then Assign it a number for that list. For instance: say I have 5 "B" items already in the "B" list, and I get another "B" Item.. I need to put that into the "B" list and have it named "B-6" for later reference.

I know it's a vague metaphor, but I don't really know another way to explain it.

Basically, I need to create an Array of two groups (GroupA[$i] & GroupB[$i]) and have them there for later reference.

Almost like having 8 rooms and each day different people stay in the rooms, but I can reference the items by room number.... If that makes sence.

there are a few ways to do what you want, the obvious being to have 2 iterators that are incremented as you append to the lists (2 dimensional array with a counter), or you could just create a file for each list, or a delimited file for both etc... you should probably look at how important the data is; assuming it's mission critical you probably don't want to have it sitting in memory in the event of an error, power outtage etc
Link to comment
Share on other sites

Hi,

Not sure if it helps, but here you go

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>
#include <GuiListBox.au3>

Global $hGui, $iListA, $iListB, $iSelectAB, $iInput, $iAddToList, $iMsg

$hGui = GUICreate("Lists", 495, 330, -1, -1)
GUICtrlCreateGroup("List A", 5, 5, 240, 275)
$iListA = GUICtrlCreateList("", 10, 20, 230, 260)
GUICtrlCreateGroup("List B", 250, 5, 240, 275)
$iListB = GUICtrlCreateList("", 255, 20, 230, 260)
GUICtrlCreateGroup("Add to List..", 5, 285, 485, 40)
$iSelectAB = GUICtrlCreateCombo("", 10, 300, 60, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "List A|List B", "List A")
$iInput = GUICtrlCreateInput("Enter Data Here....", 75, 300, 340, 20)
$iAddToList = GUICtrlCreateButton("Send to List", 420, 300, 65, 20)
GUISetState(@SW_SHOW, $hGui)

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $iAddToList
            If GUICtrlRead($iInput) <> "" Then
                Switch GUICtrlRead($iSelectAB)
                    Case "List A"
                        _ListCount($iListA)
                    Case "List B"
                        _ListCount($iListB)
                EndSwitch
            EndIf
    EndSwitch
WEnd

Func _ListCount($iList)
    Local $iCnt = _GUICtrlListBox_GetCount($iList)
    GUICtrlSetData($iList, StringFormat("%02i", $iCnt + 1) & ") " & GUICtrlRead($iInput))
EndFunc   ;==>_ListCount

Cheers

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