ComboImageList Auswahl in Ini schreiben

  • hallo,

    ein Anliegen hätte ich noch, jetzt Funktionieren ja meine ComboBoxen einwandfrei! es sind ja Comboboxen mit Farbauswahl, jetzt möchte ich, dass die Ausgewählte Farbe als HexCode in einer Ini gespeichert wird!

    dies macht man ja mit "IniWrite"

    ich habe da schon einen Versuch gestartet, Farbauswahl und danach der Buttonclick funktioniert, nur an der stelle an der die Farbe als HexCode stehen sollte, steht eine einfache "0"

    Bitte um Hilfe

    MfG, Facemix

    meine Spezialität: Windowstools für eine leichtere Arbeit am PC

    Nicht veröffentlicht


    nicht veröffentlichte Programme von mir

    - FTP Filereader
    - Youtube Kanal Player
    -GDI+ Countdown (bis zu einem Wunderbaren ereignis :) )

    MyPastebin

  • sehr Hilfreich :D

    MfG, Facemix

    meine Spezialität: Windowstools für eine leichtere Arbeit am PC

    Nicht veröffentlicht


    nicht veröffentlichte Programme von mir

    - FTP Filereader
    - Youtube Kanal Player
    -GDI+ Countdown (bis zu einem Wunderbaren ereignis :) )

    MyPastebin

    • Offizieller Beitrag

    Mensch zeig deinen Code, sonst wirst du noch mehr Glaskugeln sehen. [Blockierte Grafik: http://www.greensmilies.com/smile/smiley_emoticons_glaskugel4.gif]


    Übrigens ist meine kaput.[Blockierte Grafik: http://www.greensmilies.com/smile/smiley_emoticons_glaskugel.gif]

  • oh tut mir leid klar :D also mein Code sieht bisher so aus!!

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <GuiConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Local $Form1, $hImage1, $hImage2, $hCombo1, $hCombo2

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $ini_file = @ScriptDir & "\test.ini"
    If FileExists($ini_file) Then
    $bgcolor = Int(IniRead($ini_file, "Settings", "bgcolor", 0x000000))
    $txtcolor = Int(IniRead($ini_file, "Settings", "txtcolor", 0x000000))
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Einstellungen", 362, 401, 192, 124)
    $Label1 = GUICtrlCreateLabel("Wählen Sie hier die Hintergrundfarbe und die Textfarbe aus!", 8, 8, 346, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Hintergrundfarbe:", 8, 56, 103, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $hCombo1 = _GUICtrlComboBoxEx_Create($Form1, "", 8, 88, 337, 200)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage1 = _GUIImageList_Create(16, 16, 5, 5)
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo1, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo1, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo1, 0x0000FF, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo1, 0x000000, 16, 16))
    _GUICtrlComboBoxEx_SetImageList($hCombo1, $hImage1)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlComboBoxEx_AddString($hCombo1, "Rot", 0, 0)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Grün", 1, 1)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Blau", 2, 2)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Schwarz", 3, 3)

    [/autoit] [autoit][/autoit] [autoit]

    $Label3 = GUICtrlCreateLabel("TextFarbe:", 8, 136, 65, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $hCombo2 = _GUICtrlComboBoxEx_Create($Form1, "", 8, 168, 337, 200)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage2 = _GUIImageList_Create(16, 16, 5, 5)
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo2, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo2, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo2, 0x0000FF, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo2, 0x000000, 16, 16))
    _GUICtrlComboBoxEx_SetImageList($hCombo2, $hImage2)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlComboBoxEx_AddString($hCombo2, "Rot", 0, 0)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Grün", 1, 1)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Blau", 2, 2)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Schwarz", 3, 3)

    [/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("Abbrechen", 56, 264, 75, 25)
    $Button2 = GUICtrlCreateButton("Übernehmen", 200, 264, 75, 25)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button1
    Case $Button2
    IniWrite($ini_file, "Settings", "bgcolor", GUICtrlRead($hCombo1))
    EndSwitch
    WEnd

    [/autoit]

    hier habe ich jetzt nur die erste Combo an diese Funktion gehängt die bei mir sowieso nicht funktioniert

    MfG, Facemix

    meine Spezialität: Windowstools für eine leichtere Arbeit am PC

    Nicht veröffentlicht


    nicht veröffentlichte Programme von mir

    - FTP Filereader
    - Youtube Kanal Player
    -GDI+ Countdown (bis zu einem Wunderbaren ereignis :) )

    MyPastebin

    • Offizieller Beitrag

    GUICtrlRead kann keine Combobox auslesen, die mittels _GUICtrlComboBoxEx_Create erstellt wurde.
    Dafür gibt es _GUICtrlComboBoxEx_GetCurSel ;)

    Edit: Btw, wie denkst du, das du den Hexwert der Farbe bekommst, wenn dieser nirgends hinterlegt ist?
    Die Imagelist hat nix mit deinem Combo zu tun und der Hexwert der Farbe des BMP wird dir auch nix bringen, den kannst du nicht direkt auslesen.

  • wie könnt ich des dann in meinem Fall einbauen, bei mir will es immernoch nicht ganz funktionieren :/

    MfG, Facemix

    meine Spezialität: Windowstools für eine leichtere Arbeit am PC

    Nicht veröffentlicht


    nicht veröffentlichte Programme von mir

    - FTP Filereader
    - Youtube Kanal Player
    -GDI+ Countdown (bis zu einem Wunderbaren ereignis :) )

    MyPastebin

    • Offizieller Beitrag
    [autoit]

    #Region - Timestamp
    ; 2012-11-27 20:14:33
    #EndRegion

    [/autoit][autoit][/autoit][autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiComboBoxEx.au3>
    #include <GuiImageList.au3>
    #include <GuiConstantsEx.au3>

    [/autoit][autoit][/autoit][autoit]

    Local $Form1, $hImage1, $hImage2, $hCombo1, $hCombo2

    [/autoit][autoit][/autoit][autoit]

    Global Const $ini_file = @ScriptDir & "\test.ini"
    If FileExists($ini_file) Then
    $bgcolor = Int(IniRead($ini_file, "Settings", "bgcolor", 0x000000))
    $txtcolor = Int(IniRead($ini_file, "Settings", "txtcolor", 0x000000))
    EndIf

    [/autoit][autoit][/autoit][autoit]

    #region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Einstellungen", 362, 401, 192, 124)
    $Label1 = GUICtrlCreateLabel("Wählen Sie hier die Hintergrundfarbe und die Textfarbe aus!", 8, 8, 346, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Hintergrundfarbe:", 8, 56, 103, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $hCombo1 = _GUICtrlComboBoxEx_Create($Form1, "", 8, 88, 337, 200)

    [/autoit][autoit][/autoit][autoit]

    $hImage1 = _GUIImageList_Create(16, 16, 5, 5)
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo1, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo1, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo1, 0x0000FF, 16, 16))
    _GUIImageList_Add($hImage1, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo1, 0x000000, 16, 16))
    _GUICtrlComboBoxEx_SetImageList($hCombo1, $hImage1)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Rot", 0, 0)
    _GUICtrlComboBoxEx_SetItemParam($hCombo1, 0, 0xFF0000)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Grün", 1, 1)
    _GUICtrlComboBoxEx_SetItemParam($hCombo1, 1, 0x00FF00)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Blau", 2, 2)
    _GUICtrlComboBoxEx_SetItemParam($hCombo1, 2, 0x0000FF)
    _GUICtrlComboBoxEx_AddString($hCombo1, "Schwarz", 3, 3)
    _GUICtrlComboBoxEx_SetItemParam($hCombo1, 3, 0x000000)

    [/autoit][autoit][/autoit][autoit]

    $Label3 = GUICtrlCreateLabel("TextFarbe:", 8, 136, 65, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $hCombo2 = _GUICtrlComboBoxEx_Create($Form1, "", 8, 168, 337, 200)

    [/autoit][autoit][/autoit][autoit]

    $hImage2 = _GUIImageList_Create(16, 16, 5, 5)
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo2, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo2, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo2, 0x0000FF, 16, 16))
    _GUIImageList_Add($hImage2, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo2, 0x000000, 16, 16))
    _GUICtrlComboBoxEx_SetImageList($hCombo2, $hImage2)

    [/autoit][autoit][/autoit][autoit]

    _GUICtrlComboBoxEx_AddString($hCombo2, "Rot", 0, 0)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Grün", 1, 1)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Blau", 2, 2)
    _GUICtrlComboBoxEx_AddString($hCombo2, "Schwarz", 3, 3)

    [/autoit][autoit][/autoit][autoit]

    $Button1 = GUICtrlCreateButton("Abbrechen", 56, 264, 75, 25)
    $Button2 = GUICtrlCreateButton("Übernehmen", 200, 264, 75, 25)
    GUISetState(@SW_SHOW)
    #endregion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    Case $Button1
    Case $Button2
    ConsoleWrite("Index Auswahl:"&_GUICtrlComboBoxEx_GetCurSel($hCombo1) & @CRLF)
    ConsoleWrite("Farbe als Integer:"&_GUICtrlComboBoxEx_GetItemParam($hCombo1, _GUICtrlComboBoxEx_GetCurSel($hCombo1)) & @CRLF)
    ConsoleWrite("Farbe als Hex:"&Hex(_GUICtrlComboBoxEx_GetItemParam($hCombo1, _GUICtrlComboBoxEx_GetCurSel($hCombo1))) & @CRLF)
    IniWrite($ini_file, "Settings", "bgcolor", _GUICtrlComboBoxEx_GetItemParam($hCombo1, _GUICtrlComboBoxEx_GetCurSel($hCombo1)))
    EndSwitch
    WEnd

    [/autoit]


    Der Wert wird als Zahl in die Ini geschrieben, diesen kannst du auch wieder direkt verwenden. Autoit ist es Egal ob du Hex oder Int benutzt.

  • ah ok danke, das Funktioniert gut :)

    habe in der Zeit auch selbst noch ein Wenig experimentiert, und bin auch auf eine Lösung gekommen.
    diese sieht so aus:

    [autoit]

    Case $Button2
    $hlist = _GUICtrlComboBoxEx_GetCurSel($hCombo1)

    [/autoit][autoit][/autoit][autoit]

    If $hlist = 0 Then
    IniWrite($ini_file, "Settings", "bgcolor", "0xFF0000")
    ElseIf $hlist = 1 Then
    IniWrite($ini_file, "Settings", "bgcolor", "0x00FF00")
    ElseIf $hlist = 2 Then
    IniWrite($ini_file, "Settings", "bgcolor", "0x0000FF")
    ElseIf $hlist = 3 Then
    IniWrite($ini_file, "Settings", "bgcolor", "0x000000")
    EndIf

    [/autoit]

    Funktioniert ebenfalls aber danke für die Hilfe :)

    MfG, Facemix

    meine Spezialität: Windowstools für eine leichtere Arbeit am PC

    Nicht veröffentlicht


    nicht veröffentlichte Programme von mir

    - FTP Filereader
    - Youtube Kanal Player
    -GDI+ Countdown (bis zu einem Wunderbaren ereignis :) )

    MyPastebin