|
You last visited: Today at 00:56
Advertisement
Array ausgeben
Discussion on Array ausgeben within the AutoIt forum part of the Coders Den category.
02/23/2012, 22:21
|
#1
|
elite*gold: 0
Join Date: Feb 2009
Posts: 542
Received Thanks: 112
|
Array ausgeben
Hey,
ich hab grad irwi ne denkblockade also:
PHP Code:
Global $player[8][2] = [["player 1", 0], ["player 2",4], ["player 3",8], ["player 4", 12], ["player 5", 16] , ["player 6", 20], ["player 7", 24], ["player 8", 28]] #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("speed", 698, 86, 192, 124) $combo = GUICtrlCreateCombo("Player", 8, 16, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $COMBO1 = GUICtrlSetData(-1, "" & $PLAYER[0][0] & "|" & $PLAYER[1][0] & "|" & $PLAYER[2][0] & "|" & $PLAYER[3][0] & "|" & $PLAYER[4][0] & "|" & $PLAYER[5][0] & "|" & $PLAYER[6][0] & "|" & $PLAYER[7][0] & "") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch MsgBox(0,"",GUICtrlRead($COMBO)) WEnd
[/PHP]
so bekomme ich nur beim auslesen was da in der comboboy auch steht, ich möchte aba wenn zum beispiel player 5 ausgewählt wird, das in der msg box statt player 5 steht, nur 16 also das $player[4][1] ausgegeben wird statt $player[4][0] ich hab aba irwi grad kein plan wie xD
|
|
|
02/24/2012, 00:02
|
#2
|
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
|
Wenn die Zahl am Ende des Textes in gleichmäßigen Abständen zunimmt wäre das z. B. eine einfache Lösung:
Code:
#include <ComboConstants.au3>
Dim $Array[4][2] = [["Bla 1", 123], ["Bla 2", 456], ["Bla 3", 789], ["Bla 4", 0]]
GUICreate("Blaa", 150, 100)
$DropDownList = GUICtrlCreateCombo($Array[0][0], 5, 5, 140, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($Array) - 1
GUICtrlSetData($DropDownList, $Array[$i][0], True)
Next
$Button = GUICtrlCreateButton("MessageBox", 5, 35, 140, 25)
GUISetState()
Do
$Msg = GUIGetMsg()
If $Msg == $Button Then
MsgBox(0, "", $Array[StringRight(GUICtrlRead($DropDownList), 1) - 1][1])
EndIf
Sleep(25)
Until $Msg == -3
Andernfalls könntest du das Array mit einer For-Schleife durchgehen und die Texte vergleichen, sobald der Text übereinstimmt gibst du die Zahl des des Array aus.
Code:
#include <ComboConstants.au3>
Dim $Array[4][2] = [["Bla 1", 123], ["Bla 2", 456], ["Bla 3", 789], ["Bla 4", 0]]
GUICreate("Blaa", 150, 100)
$DropDownList = GUICtrlCreateCombo($Array[0][0], 5, 5, 140, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($Array) - 1
GUICtrlSetData($DropDownList, $Array[$i][0], True)
Next
$Button = GUICtrlCreateButton("MessageBox", 5, 35, 140, 25)
GUISetState()
Do
$Msg = GUIGetMsg()
If $Msg == $Button Then
For $i = 0 To UBound($Array) - 1
If GUICtrlRead($DropDownList) == $Array[$i][0] Then
MsgBox(0, "", $Array[$i][1])
ExitLoop
EndIf
Next
EndIf
Sleep(25)
Until $Msg == -3
|
|
|
02/24/2012, 11:58
|
#3
|
elite*gold: 0
Join Date: Feb 2009
Posts: 542
Received Thanks: 112
|
danke, aba ich hab mir das dann ganz einfach gemacht
Code:
$comboa = StringSplit(GUICtrlRead($combo)," ")
msgbox(0,"",$comboa[2])
|
|
|
02/24/2012, 17:40
|
#4
|
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,147
|
Dann würdest du aber nur die Zahl aus dem String erhalten. Von diesem Wert müsstest du noch 1 subtrahieren und dann das $Array[x][1] ausgeben.
Sprich:
Code:
$comboa = StringSplit(GUICtrlRead($combo)," ")
msgbox(0,"", $Array[$comboa[2] - 1][1])
Das macht aber nichts anderes als der erste Code von mir.
|
|
|
|
Similar Threads
|
Beliebiges Array
12/11/2011 - AutoIt - 0 Replies
Schon beim schreiben dieses topics gelöst :D
Moin,
ich hab da ein kleines Problem an dem ich nicht weiter komme:
$read = IniReadSection(".\ini.ini","offset& quot;)
$offsetsreihe = ""
|
Array
06/18/2011 - AutoIt - 0 Replies
Array Fehler
Ich habe hier mal wieder einen Fehler den ich nicht beheben kann
#include "WebTcp.au3"
#include <Array.au3>
#Include <File.au3>
TCPStartup()
_AutoITObject_Startup()
|
2D Array hilfe ;)
10/22/2010 - AutoIt - 2 Replies
Hallo,
ich arbeite mittlerweie schon seht viel mit autoit.
Nun wollte ich ein Programm mit einer listview schreiben, wobei es die Daten aus einem txt Dokument entnimmt.
Das txt Dokument sieht so aus:
1,2,3
4,5,6
|
Hilfe mit Array in C#
02/11/2007 - .NET Languages - 3 Replies
Also ich bräuchte mal eure Hilfe.
Wir haben als Aufgabenstellung :
Ein Array feld mit beliebig vielen zahlen(aufsteigend sortiert) dann sollen wir eine Zahl einlessen und diese wird dann wieder aufsteigend in das array feld rein sotiert.(ganze Zahlen)
Also ein bisschen was hab ich schon geschafft naja nicht viel ^^:
Also da werden mal die standart Zahlen ausgegeben und die Zahl zum einsotieren eingelessen dann werden die standart Zahlen noch so weit bis sie geordnet werden müssen...
|
All times are GMT +2. The time now is 00:56.
|
|