Morgen,
ich schriebe gerad einen ganz kleinen und primitiven Vokabeltrainer.
Zur erklärung es geht um japanisch. Dafür brauche ich 3 spalten. kanji romaji und deutsch.
Problem das ich gerade habe: jedes element sollte ein einzellner Button sein den man mit klick sichtbar bzw unsichtbar machen kann.
Nun habe ich ein gigantische array von evtl 200 buttons und will mit klick auf diesen den text ändern. (nicht sichtbarkeit weil man den button sonst nicht mehr anklicken kann ^^)
Gedacht war sowas
dim $buttonKanji[40]
While 1
Switch GUIGetMsg()
Case $buttonKanji
;ändere den Text des gedrückten button
;sprich guictrlsetdata($buttonKanji[self] , "sinlosser Text"
hattes das schonmal gemacht finde aber die Codezeile nicht wieder. weis noch einer wie man einzelne Elemente aus dem array ansteuert?
und nein ich will case $buttonKanji[$i] 200 mal schreiben das ist ja käse
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
; Create an INI section structure as a string.
Local $sSection = "1=qw" & @CRLF & "2=qw" & @CRLF & "3=qw"
Local $sSection = "1=neku" & @CRLF & "2=sara" & @CRLF & "3=hito"
Local $sSection = "1=katze" & @CRLF & "2=teller" & @CRLF & "3=mensch"
; Write the string to the section labelled 'General'.
IniWriteSection(@DesktopDir & "\Example.ini", "Kanji", $sSection)
IniWriteSection(@DesktopDir & "\Example.ini", "romaji", $sSection)
IniWriteSection(@DesktopDir & "\Example.ini", "deutsch", $sSection)
; Read the INI section labelled 'General'. This will return a 2 dimensional array.
Local $kanji = IniReadSection(@DesktopDir & "\Example.ini", "Kanji")
Local $romaji = IniReadSection(@DesktopDir & "\Example.ini", "romaji")
Local $deutsch = IniReadSection(@DesktopDir & "\Example.ini", "deutsch")
;MsgBox(0,$kanji[0][0],"")
Global $button1[$kanji[0][0]+1]
Global $button2[$kanji[0][0]+1]
Global $button3[$kanji[0][0]+1]
Local $hGUI = GUICreate("Example", 400, 200)
$bhide1= GUICtrlCreateButton( "alle verstecken" , 20,30,100,20)
$bhide2= GUICtrlCreateButton( "alle verstecken" , 150,30,100,20)
$bhide3= GUICtrlCreateButton( "alle verstecken" , 280,30,100,20)
; Check if an error occurred.
If Not @error Then
; Enumerate through the array displaying the keys and their respective values.
For $i = 1 To $kanji[0][0]
; MsgBox($MB_SYSTEMMODAL, "", "Key: " & $aArray[$i][0] & @CRLF & "Value: " & $aArray[$i][1])
$button1[$i] = GUICtrlCreateButton( $kanji[$i][1] , 20,50+(20*$i),100,20)
$button2[$i] = GUICtrlCreateButton( $romaji[$i][1] , 150,50+(20*$i),100,20)
$button3[$i] = GUICtrlCreateButton( $deutsch[$i][1] , 280,50+(20*$i),100,20)
Next
EndIf
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $button1
MsgBox(0,"",GUIGetMsg())
Case $bhide1
if GUICtrlRead($bhide1)="alle verstecken" then
for $i=1 to UBound($button1)-1
GUICtrlSetData($button1[$i],"....................................." & GUICtrlRead($button1[$i]))
Next
GUICtrlSetData($bhide1,"alle zeigen")
Else
for $i=1 to UBound($button1)-1
GUICtrlSetData($button1[$i],StringReplace( GUICtrlRead($button1[$i]),".",""))
Next
GUICtrlSetData($bhide1,"alle verstecken")
EndIf
;++++++2
Case $bhide2
if GUICtrlRead($bhide2)="alle verstecken" then
for $i=1 to UBound($button2)-1
GUICtrlSetData($button2[$i],"....................................." & GUICtrlRead($button2[$i]))
Next
GUICtrlSetData($bhide2,"alle zeigen")
Else
for $i=1 to UBound($button2)-1
GUICtrlSetData($button2[$i],StringReplace( GUICtrlRead($button2[$i]),".",""))
Next
GUICtrlSetData($bhide2,"alle verstecken")
EndIf
;###
Case $bhide3
if GUICtrlRead($bhide3)="alle verstecken" then
for $i=1 to UBound($button3)-1
GUICtrlSetData($button3[$i],"....................................." & GUICtrlRead($button3[$i]))
Next
GUICtrlSetData($bhide3,"alle zeigen")
Else
for $i=1 to UBound($button3)-1
GUICtrlSetData($button3[$i],StringReplace( GUICtrlRead($button3[$i]),".",""))
Next
GUICtrlSetData($bhide3,"alle verstecken")
EndIf
EndSwitch
WEnd
EndFunc ;==>Example
func _pressed()
MsgBox(0,"","")
EndFunc
Alles anzeigen