Hey Leute,
ich habe ein Problem beim erstellen von items.
hier mein code:
Spoiler anzeigen
#include <GuiListView.au3>
#include <EditConstants.au3>
#include 'LV_Format_include.au3'
#include <GuiButton.au3>
Global $hLV,$GUI
[/autoit] [autoit][/autoit] [autoit]$GUI = GUICreate('')
$lv = GUICtrlCreateListView("Test1|Test2", 10, 10, 300, 150)
$btn_hinzu = _GUICtrlButton_Create($GUI, "hinzufügen", 10, 200, 90, 50)
$btn_loesch = _GUICtrlButton_Create($GUI, "lösche", 10, 250, 90, 50)
$hLV = GUICtrlGetHandle($lv)
[/autoit] [autoit][/autoit] [autoit]$GUI_Format =GUICreate("Hinzüfgen", 239, 196, 331, 468)
$Label1 = GUICtrlCreateLabel("1. Busfahrt", 8, 40, 55, 17)
$Label5 = GUICtrlCreateLabel("Telekom", 8, 72, 45, 17)
$Label9 = GUICtrlCreateLabel("2. Busfahrt", 8, 104, 55, 17)
$chb_urlaub = GUICtrlCreateCheckbox("Urlaub", 8, 160, 65, 25)
$Label2 = GUICtrlCreateLabel("Datum", 8, 136, 35, 17)
$Start = GUICtrlCreateLabel("Start Zeit:", 80, 8, 50, 17)
$Label3 = GUICtrlCreateLabel("End Zeit", 152, 8, 44, 17)
$txt_bus1_start = GUICtrlCreateInput("06:00", 72, 32, 65, 21)
$txt_bus1_ende = GUICtrlCreateInput("06:30", 152, 32, 65, 21)
$txt_telekom_start = GUICtrlCreateInput("09:00", 72, 64, 65, 21)
$txt_telekm_ende = GUICtrlCreateInput("16:00", 152, 64, 65, 21)
$txt_bus2_start = GUICtrlCreateInput("17:00", 72, 96, 65, 21)
$txt_bus2_ende = GUICtrlCreateInput("20:00", 152, 96, 65, 21)
$txt_datum = GUICtrlCreateInput("1.1.2012", 72, 128, 145, 21)
$bt_hinzufoegen_ = GUICtrlCreateButton("Hinzufügen", 72, 160, 145, 25)
;das hier geht
_GUICtrlListView_Formatting_Startup($GUI, $hLV)
_GUICtrlListView_AddOrIns_Item($hLV, 'Test0|Test1')
_GUICtrlListView_FormattingCell($hLV, 0, 0, 0xff0000, -1, -1, 600, 'Times New Roman')
;das hier geht
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUISetState(@SW_SHOW, $GUI)
While 1
$msg = GUIGetMsg(1)
Switch $msg[1]
Case $GUI
If $msg[0] = -3 Then ExitLoop
Case $GUI_Format
If $msg[0] = -3 Then
GUISetState(@SW_HIDE, $GUI_Format)
;_setFormat()
EndIf
EndSwitch
WEnd
func _bt_click_hinzufuegen()
GUISetState(@SW_SHOW, $GUI_Format)
EndFunc
func _test()
_GUICtrlListView_Formatting_Startup($GUI, $hLV)
_GUICtrlListView_AddOrIns_Item($hLV, 'Test0|Test1')
_GUICtrlListView_FormattingCell($hLV, 0, 0, 0xff0000, -1, -1, 600, 'Times New Roman')
EndFunc
; Reaktion auf einen Button-Klick
Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
#forceref $hWnd, $Msg
Local $nNotifyCode = BitShift($wParam, 16)
Local $nID = BitAND($wParam, 0x0000FFFF)
Local $hCtrl = $lParam
Local $sText = ""
;if $lParam =
Switch $hCtrl
Case $btn_hinzu
Switch $nNotifyCode
Case $BN_CLICKED
_bt_click_hinzufuegen()
EndSwitch
Case $btn_loesch
Switch $nNotifyCode
Case $BN_CLICKED
msgbox(64,"test","Test")
EndSwitch
Case GUICtrlGetHandle($bt_hinzufoegen_)
Switch $nNotifyCode
Case $BN_CLICKED
msgbox(64,"test","Test")
_test()
EndSwitch
Return 0 ; Nur bei Klick auf den Button
EndSwitch
; Setzt die Standardverarbeitung der Autoit3-internen Nachrichtenkommandos fort.
; Man kann die Zeile auch weglassen.
; !!! Aber nur 'Return' (ohne jegliche Variable) wird die Verarbeitung der Standardnachrichten unterbinden !!!
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_COMMAND
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iCode, $tNMHDR
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iCode = DllStructGetData($tNMHDR, "Code")
; If ($hWndFrom = $hLV Or $hWndFrom = $hLV2) And $iCode = $NM_RCLICK Then _RightClick()
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
Ich kann z .b beim aufruf der Function _test() keine items erstellen.
Wie muss ich den Code schreiben, damit ich aus jeder beliebigen Funktion items erstellen und die Farben ändern kann?
zusätzlich will ich ab einem bestimmtem Wert (Subitem) die Farbe ändern.