Startseite › Foren › Deutsches LiveCode-Forum › Aktuelles Bild in globales Array speichern. › Antwort auf: Aktuelles Bild in globales Array speichern.
April 29, 2019 um 10:23 Uhr
#14401
Super toll…
Hier nochmal meine Fortschritte. Ich kann nun Bilder wählen und auch wieder abwählen.
Bild wählen:
on mouseup
global gAuswahl
put filename of img id 3506 into tAuswahl
## Checken, ob Bild schon mal ausgewählt wurde:
if lineoffset(tAuswahl,gAuswahl) <> 0 then
answer "Dieses Bild ist schon ausgewählt."
exit mouseup
end if
## Hier prüfen wir ob die Variable schon 10 Zeilen enthält
if the num of lines of gAuswahl = 10 then
answer "Sie können maximal 10 Bilder pro Set wählen."
else
## Nun an gAuswahl anhängen:
show image "check"
## Wenns nicht leer ist packt er noch ein return (CR) davor
if gAuswahl <> EMPTY then
## Wir fügen tAuswahl als NEUE Zeile an!
put CR before tAuswahl
end if
## Jetzt packt er die Zeile "tAuswahl" rein
put tAuswahl after gAuswahl
end if
end mouseup
Bild abwählen:
on mouseup
global gAuswahl
put filename of img id 3506 into tAuswahl
# Ist das aktuelle Bild in der Variable
put lineoffset(tAuswahl,gAuswahl) into tLine
if tLine = 0 then #wenn nein
answer "Dieses Bild ist nicht ausgewählt"
else #wenn ja
# wimpel verstecken
hide image "check"
# Zeile leer machen
put empty into item 1 of line tLine of gAuswahl
# gAuswahl neu sortieren ohne Leerzeilen
filter gAuswahl without EMPTY
end if
#put gAuswahl into field tTest
end mouseup
Vielleicht hilft es ja dem ein oder anderen…
Vielen Dank Klaus, ich bin somit fertig 😀
Grüße Tobias