Mehrere Fragen: Guigrößen per Button ändern, ...

  • Hallo zusammen

    Habe ein paar Fragen zu einem programm, welches ich gerade bastle. Bin noch nicht allzuvertraut mit AutoIt. Ich versuch zwar immer mit der Hilfe zu arbeiten (die echt klasse ist ;) dickes Lob) aber bei ein paar sachen finde ich jetz nicht weiter

    Nr. 1:

    In meinem Gui versuche ich mit einem Button, das Gui Fenster zu vergrößern bzw. es zu verkleinern. Da die jeder unterschiedlich viele funktionen meines Programmes nutzen wird.
    Hab da auch eine möglichkeit gefunden dies einigermaßen zu erreichen finde diese lösung aber sehr unpraktisch, und ich glaube das Gui wird dadurch verzerrt. Meine lösung wäre in etwa so:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>

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

    $gui = GUICreate('',400 ,100 ,@DesktopWidth/3 ,@desktopheight/3)
    GUISetState()
    $button1 = GUICtrlCreateButton("+", 20,20,20,20)
    $button2 = GUICtrlCreateButton("-", 20,16,20,20)
    Guictrlsetstate($button2,$GUI_HIDE)
    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    Case $msg = $button1
    WinMove($gui,"",@DesktopWidth/3 ,@desktopheight/3,400,200,1)
    Guictrlsetstate($button1,$GUI_HIDE)
    Guictrlsetstate($button2,$GUI_SHOW)
    Case $msg = $button2
    WinMove($gui,"",@DesktopWidth/3 ,@desktopheight/3,400,100,1)
    Guictrlsetstate($button2,$GUI_HIDE)
    Guictrlsetstate($button1,$GUI_SHOW)
    EndSelect
    WEnd

    [/autoit]

    In prinzip so:
    [Blockierte Grafik: http://web1222.jenny.webhoster.ag/schnitzel/Autoit/Vorher.bmp]

    Bei click auf den "+" button links:
    [Blockierte Grafik: http://web1222.jenny.webhoster.ag/schnitzel/Autoit/nachher1.bmp
    wird das gui vergrößert und der vorherige "+" button in einen "-" button geändert, mit dem man das fenster wieder kleiner machen kann


    Nr.2:

    So weiter gehts mit hm ja einer "automatischen erstellung weiterer guielemente". Kurzum: In meinem gui sollen immer wieder die gleichen comboboxen(mit den selben auswahlitems), die inputboxen und checkboxen untereinander erstellt werden, wenn man wie oben beschrieben auf den button klickt um das gui zu vergößern. besonders die comboboxen sind halt sehr viel text und ich dachte das geht bestimmt auch leichter blos wie???
    Die Button, Comboboxen, inputboxen, usw. sollten vllt einfach durchnummeriert sein, und da das soviel code ist, obwohl es immer wieder die gleichen elemente sind, wollt ich mal nachfragen ob da jmd eine elegantere lösung parat hat

    anders würds so aussehn (allein die comboboxen -.-)

    Spoiler anzeigen
    [autoit]

    $FunktionGroup = GUICtrlCreateGroup("Funktion des Buttons", 104, 8, 257, 865)
    $Combo1 = GUICtrlCreateCombo("", 112, 36, 241, 25)
    GUICtrlSetData($Combo1, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo2 = GUICtrlCreateCombo("", 112, 68, 241, 25)
    GUICtrlSetData($Combo2, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo3 = GUICtrlCreateCombo("", 112, 100, 241, 25)
    GUICtrlSetData($Combo3, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo4 = GUICtrlCreateCombo("", 112, 132, 241, 25)
    GUICtrlSetData($Combo4, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo5 = GUICtrlCreateCombo("", 112, 164, 241, 25)
    GUICtrlSetData($Combo5, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo6 = GUICtrlCreateCombo("", 112, 196, 241, 25)
    GUICtrlSetData($Combo6, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo7 = GUICtrlCreateCombo("", 112, 228, 241, 25)
    GUICtrlSetData($Combo7, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo8 = GUICtrlCreateCombo("", 112, 260, 241, 25)
    GUICtrlSetData($Combo8, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo9 = GUICtrlCreateCombo("", 112, 292, 241, 25)
    GUICtrlSetData($Combo9, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo10 = GUICtrlCreateCombo("", 112, 324, 241, 25)
    GUICtrlSetData($Combo10, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo11 = GUICtrlCreateCombo("", 112, 356, 241, 25)
    GUICtrlSetData($Combo11, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo12 = GUICtrlCreateCombo("", 112, 388, 241, 25)
    GUICtrlSetData($Combo12, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo13 = GUICtrlCreateCombo("", 112, 420, 241, 25)
    GUICtrlSetData($Combo13, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo14 = GUICtrlCreateCombo("", 112, 452, 241, 25)
    GUICtrlSetData($Combo14, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo15 = GUICtrlCreateCombo("", 112, 484, 241, 25)
    GUICtrlSetData($Combo15, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo16 = GUICtrlCreateCombo("", 112, 516, 241, 25)
    GUICtrlSetData($Combo16, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo17 = GUICtrlCreateCombo("", 112, 548, 241, 25)
    GUICtrlSetData($Combo17, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo18 = GUICtrlCreateCombo("", 112, 580, 241, 25)
    GUICtrlSetData($Combo18, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo19 = GUICtrlCreateCombo("", 112, 612, 241, 25)
    GUICtrlSetData($Combo19, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo20 = GUICtrlCreateCombo("", 112, 644, 241, 25)
    GUICtrlSetData($Combo20, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo21 = GUICtrlCreateCombo("", 112, 676, 241, 25)
    GUICtrlSetData($Combo21, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo22 = GUICtrlCreateCombo("", 112, 708, 241, 25)
    GUICtrlSetData($Combo22, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo23 = GUICtrlCreateCombo("", 112, 740, 241, 25)
    GUICtrlSetData($Combo23, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo24 = GUICtrlCreateCombo("", 112, 772, 241, 25)
    GUICtrlSetData($Combo24, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo25 = GUICtrlCreateCombo("", 112, 804, 241, 25)
    GUICtrlSetData($Combo25, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")
    $Combo26 = GUICtrlCreateCombo("", 112, 836, 241, 25)
    GUICtrlSetData($Combo26, "Auswahl1 | Auswahl2| Auswahl3| Auswahl4| Auswahl5| Auswahl6| Auswahl7| Auswahl8")

    [/autoit]

    Und zu guter letzt Nr.3:

    Mit dem Programm Vtfedit (Download: http://www.mpcdownloads.com/forums/downloa…fedit/6318.html) kann man Bilddateien Importieren und diese etwas bearbeiten und dann im .vtf-Format abspeichern. Da es ja möglich ist Bmp in Jpg umzuwandeln, wollte ich fragen ob sowas auch für diesen prozess möglich ist. Also Jpg in Vtf.

    Sieht etwa so aus:
    [Blockierte Grafik: http://web1222.jenny.webhoster.ag/schnitzel/Autoit/Vftedit.bmp]

    Mir reicht bei den drei fragen ein verweis auf die hilfe oder bereits vorhandene beiträge, da ich gerne auch bisschen rumtüfftle. Hab halt leider so nichts dazu gefunden.
    Kurze Beispiele zur veranschaulichung wären natürlich hammermäßig

    Vielen dank schonmal im vorraus :)

    • Offizieller Beitrag

    Also erstmal solltest Du unbedingt den OnEvent-Mode benutzen, das ist hier viel einfacher, weil man den dynamisch erstellten Buttons immer die gleiche Funktion zuweisen kann.
    Das benutzen von Arrays ist ebenfalls eine logische Konsequenz dabei.
    Als kleines Beispiel, wie das aussehen könnte:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    Opt('GUIOnEventMode', 1)
    Opt('GUIResizeMode', 802)

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

    Global $iCount = 1
    Global $aButton[$iCount]
    Global $iHeight = 100
    Global $iPosH = 30
    $hGui = GUICreate('', 400, $iHeight, @DesktopWidth / 3, @DesktopHeight / 3)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_End')
    $aButton[$iCount - 1] = GUICtrlCreateButton("+", 20, $iPosH, 20, 20)
    GUICtrlSetOnEvent(-1, '_AddButton')

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

    GUISetState()

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

    While True
    Sleep(50)
    WEnd

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

    Func _End()
    Exit
    EndFunc ;==>_End

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

    Func _AddButton()
    GUICtrlSetData($aButton[$iCount - 1], '-')
    GUICtrlSetOnEvent($aButton[$iCount - 1], '_DelButton')
    $iCount += 1
    ReDim $aButton[$iCount]
    $iPosH += 30
    $aButton[$iCount - 1] = GUICtrlCreateButton("+", 20, $iPosH, 20, 20)
    GUICtrlSetOnEvent(-1, '_AddButton')
    $iHeight += 30
    WinMove($hGui, '', @DesktopWidth / 3, @DesktopHeight / 3, 400, $iHeight)
    EndFunc ;==>_AddButton

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

    Func _DelButton()
    GUICtrlDelete($aButton[$iCount - 1])
    GUICtrlSetData($aButton[$iCount - 2], '+')
    GUICtrlSetOnEvent($aButton[$iCount - 2], '_AddButton')
    $iCount -= 1
    ReDim $aButton[$iCount]
    $iPosH -= 30
    $iHeight -= 30
    WinMove($hGui, '', @DesktopWidth / 3, @DesktopHeight / 3, 400, $iHeight)
    EndFunc

    [/autoit]
  • Hi,
    VTF ist ja ein recht unbekanntes Format :).

    Mit AutoIt ist das bis jetzt noch nicht umgesetzt, das wird auch nicht so einfach sein.
    Aber IrfanView kann mit Plugins in VTF Convertieren. IrfanView öässt sich per Batch prima ansteuern, also könntest du mal damit dein Glück probieren und es mit AutoIt ansteuern ;).

    anno2008 8)

  • ja ist leider nicht recht weit verbreitet, aber der tipp mit irvanview hört sich schonmal sehr gut an

    vielen dank

    ich werds probiern, aber ich denk mal das dauert bis ichs hinbekomm^^