Voneinander abhängige DDL (DropDownList) Topic is solved

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

GamerG1rl
Posts: 48
Joined: 23 Nov 2017, 04:44

Voneinander abhängige DDL (DropDownList)

23 Nov 2017, 04:50

Hallöchen,

ich hatte mal ein wenig in AHK gecodet... Leider ist das ganze schon ein paar Jahre her und ich bin ein wenig eingerostet :D
Aktuell sitze ich vor folgendem Problem:

Ich habe um Gui 2 DropDownList's.
In der einen stehen aktuell 4 Autobahnen zur Auswahl (testweise. soll nachher noch erweitert werden)
In der 2. sollen die Richtungen stehen, auf die in der (von der 1. DDL) Autobahn gefahren werden kann.

Code: Select all

Gui, Unfall:Add, DropDownList, x10 y80 w120 h21 r200 vAutobahn_DDL, A1|A2|A3|A4

if (Autobahn_DDL=="A1"){
	Gui, Unfall:Add, DropDownList, x170 y80 w120 h21 r200 vRichtung_DDL, Richtung Aachten|Richtung Köln
}
if (Autobahn_DDL=="A2"){
	Gui, Unfall:Add, DropDownList, x170 y80 w120 h21 r200 vRichtung_DDL, Richtung Bonn|Richtung Dortmund
}
Das ganze so zu lösen ist natürlich kompletter Mumpitz, weil man die vAutobahn_DDL ja nicht 2x auslesen lassen kann. (bzw. wenn man das GUI zum zweiten mal Anzeigt, die Variable ja schon besetzt ist...)
Hättet ihr eine Lösung wie man das ganze am einfachsten ohne Datenbank und Datein schreiben lösen könnte ? (ist nicht mein PC deswegen is das ganze etwas komplizierter...)

Danke für eure Hilfe :)
LG Michelle
User avatar
divanebaba
Posts: 805
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Voneinander abhängige DDL (DropDownList)  Topic is solved

23 Nov 2017, 06:20

Hi.
Hier hatte jemand eine ähnliche Aufgabenstellung. Die Auswahl einer (oder der ersten) DDL bestimmt die Auswahlmöglichkeiten der darauf folgenden DDL.
https://autohotkey.com/boards/viewtopic.php?f=5&t=33622

EDIT: Der Beispielcode ist im Spoiler.
Einfach nur ein toller Typ. :mrgreen:
GamerG1rl
Posts: 48
Joined: 23 Nov 2017, 04:44

Re: Voneinander abhängige DDL (DropDownList)

24 Nov 2017, 05:27

Danke divanebaba :)

Ich poste hier einfach nochmal den Code rein (sollte mit dem verlinkten Topic irgendwas passieren ^^)

Code: Select all

j1 = 
j2 = |Elrue|Blessed Elrue|Lucky Elrue|Lix|Blessed Lix|Lucky Lix|Xir|Blessed Xir|Lucky Xir
j3 = |N/A|
j4 = |N/A|
j5 = |Aim|Nature's Agility|Magical Defense|Shield Increase|Vitality|Mentality|Speed Increase|Concentration Increase|Divine Magic
j6 = |N/A|
j7 = |HP Potion|SP Potion|HP Regeneration|SP Regeneration|Antibiotic|Antitoxin|Bless|Immunity|Antitode|Cure|Protection|Quickness|Strength Increase|Rama
j8 = |Tier 1|

Home:
Gui, Home:Add, DropDownList, x10 y35 w120 h21 R5 gDDL1 vDDL1 Choose1 AltSubmit, Select Category|Enhancement|Weapons|Armour|Scrolls|Materials|Potions
Gui, Home:Add, Text, x10 y20 w120 h15, Category:
Gui, Home:Add, DropDownList, x10 y75 w120 h21 R5 gDDL2 vDDL2 Choose1 AltSubmit
Gui, Home:Add, Text, x10 y60 w21 h13, Item:
Gui, Home:Add, Text, x10 y100 w21 h13, Tier:
Gui, Home:Add, DropDownList, x10 y115 w120 h21 R5 gDDL3 vDDL3 Choose1 AltSubmit
Gui, Home:Add, Text, x285 y30 w75 h25, Price Range:
Gui, Home:Add, Edit, x220 y55 w65 h20 vItem1,
Gui, Home:Add, Edit, x345 y55 w65 h20 vItem2,
Gui, Home:Add, Text, x295 y60 w45 h15, From - To
Gui, Home:Show, w432 h204, Fiesta Online Price Checker
return

HomeGuiClose:
ExitApp

DDL1:
Gui, Home:Submit, NoHide
   SubList:=j%DDL1% 
GuiControl,,DDL2, %SubList%
return

DDL2:
Gui, Home:Submit, NoHide
   SubList:=j%DDL2% 
GuiControl,,DDL3, %SubList%
return


DDL3:
; Gui, Home:Submit, NoHide
; SubList:=j%DDL3% 
; GuiControl,,TierC, %SubList%
return
GamerG1rl
Posts: 48
Joined: 23 Nov 2017, 04:44

Re: Voneinander abhängige DDL (DropDownList)

24 Nov 2017, 07:22

Hey. noch ne kurze Frage:
Ich hab jetzt hier diesen Code:

Code: Select all

#SingleInstance Force

;DDL LISTEN EINTRÄGE
{
;######Richtungen (DDL1)######
A1 = |Wait..|
A2 = |Richtung Köln|Richtung Frankfurt|
A3 = |Richtung Aachen|Richtung Köln|
A4 = |Richtung Köln|Richtung Bonn|
A5 = |Richtung Mönchengladbach|Richtung Koblenz|
A6 = |Richtung Köln|Richtung Bonn|
A7 = |Richtung Dreieck Sankt Augustin-West|Richtung Hennef|
A8 = |Richtung Bonn|Richtung Hennef|
A9 = |Richtung Sankt Augustin|Richtung Meckenheim|
}

Stau:
Gui, Autobahn:Add, DropDownList, x10 y35 w120 h21 R10 Choose1 vDDL1 gDDL1 AltSubmit, Select Autobahn|A3|A4|A59|A555|A559|A560|A562|A565
Gui, Autobahn:Add, Text, x10 y20 w120 h15, Autobahn:
Gui, Autobahn:Add, DropDownList, x10 y75 w120 h21 R5 Choose1 vDDL2 gDDL2 AltSubmit
Gui, Autobahn:Add, Text, x10 y60 w42 h13, Richtung:
Gui, Autobahn:Add, Text, x285 y30 w75 h25, Weitere Infos:
 

Gui, Autobahn:Add, Text, x290 y97 w100 h15, Minuten Wartezeit
Gui, Autobahn:Add, Edit, x220 y90 w65 h20 vMinuten,
Gui, Autobahn:Add, UpDown, vMeinUpDown Range1-60, 

Gui, Autobahn:Add, Text, x290 y62 w45 h15, km Stau
Gui, Autobahn:Add, Edit, x220 y55 w65 h20 vkilometer,
Gui, Autobahn:Add, UpDown, vMeinUpDown2 Range1-60, 

Gui, Autobahn:Add, Text, x10 y100 w50 h15, Zwischen
Gui, Autobahn:Add, Edit, x10 y115 w120 h20 vOrtA,
Gui, Autobahn:Add, Text, x10 y140 w50 h15, Und
Gui, Autobahn:Add, Edit, x10 y155 w120 h20 vOrtB,

Gui, Autobahn:Add, Button, x220 y155 w75 h35 gkopierenAutobahn, Kopieren
Gui, Autobahn:Add, Button, x330 y155 w75 h35 gabbrechenautobahn, Abbrechen

Gui, Autobahn:Show, w432 h204, Autobahn-Meldung
return

AutobahnGuiClose:
ExitApp

kopierenAutobahn:
{
msgbox,33,Aktueller Clipboard-Text,AKTUELLER CLIPBOARD-TEXT !!`nText wird überschrieben`n===============`n`n %clipboard%

clipboard = %DDL1% - Richtung %DDL2%`nZwischen %OrtA% und %OrtB%`n%kilometer% Stau - Wartezeit: %Minuten% Minuten
MsgBox,48,Text wurde kopiert, Folgender Text wurde kopiert: `n`n%clipboard%

return
}

abbrechenAutobahn:
{
Gui, Autobahn: Destroy
return
}


/*
############
##Autobahn##
############
*/
DDL1:
Gui, Autobahn:Submit, NoHide
   SubList:=A%DDL1% 
GuiControl,,DDL2, %SubList%
return



/*
############
##Richtung##
############
*/
DDL2:
Gui, Autobahn:Submit, NoHide
   SubList:=j%DDL2% 
GuiControl,,DDL3, %SubList%
return
ist es irgenwie möglich, von der DDL1 und DDL2 die Submit Einträge UND die AltSubmit einträge zu bekommen ? :) Mit den Ziffern kann ich nämlich in der MsgBox nicht viel anfangen ;)
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Voneinander abhängige DDL (DropDownList)

24 Nov 2017, 09:02

Wenn Du hier

Code: Select all

Gui, Autobahn:Add, DropDownList, x10 y35 w120 h21 R10 Choose1 vDDL1 gDDL1 AltSubmit, Select Autobahn|A3|A4|A59|A555|A559|A560|A562|A565
das AltSubmit weglässt, wird Dir der ausgewählte Text geliefert. Deine Listenvariablen für die DDL2 sollten dann aber dieselben Namen haben.

Code: Select all

DDL1:
Gui, Autobahn:Submit, NoHide
   SubList:=%DDL1% 
GuiControl,,DDL2, %SubList%
return

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: No registered users and 22 guests