1/2 Menü Rechtsbündig?

  • Hallo erst ma!
    Ich hab mal wieder eine Frage: Und zwas gam ich in eriner GUI Resizing drinnen. Und nun sollte das Menü 2-Teilig sein: 3 Items links, 3 rechts.
    Das ist warscheinlich nicht möglich, oder?
    MfG. tobi_girst

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Hallo tobi_girst,

    mit dem Standard-Menü a du mit GuiCtrlMenu erzeugt geht das nicht. Du müstet da schon andere Steuerelemente nehmen um mit ihnen die Optik eines Menüs nachzubauen,

    mfg (Auto)Bert

  • Dann bleibt also nur noch die Button-Variante. Aber dann ist da der Hintergrund vom Menu ja nicht dabei. Weiss gemand einen solchen Style dafür?
    MfG. tobi_girst

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Hallo tobi_girst,

    hier ein Ansatz wie du es mit GuiCtrlMenu lösen kannst:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 633, 447, 193, 125)
    $MenuItem1 = GUICtrlCreateMenu("Datei")
    $MenuItem2 = GUICtrlCreateMenu(" ")
    $MenuItem3 = GUICtrlCreateMenu("Hilfe")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    EndSwitch
    WEnd

    [/autoit]

    du müsstest dann beim Resizen entsprechend viele Leerzeichen in MenuItem2 einfügen oder entfernen,

    mfg (Auto)Bert

  • [dummy-mode]Und wie krieg ich raus, wie vile Spaces ich da brauche?[/dummy mode]

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Hallo tobi_girst,

    ich hab noch eine Lösungsmöglichkeit für dich (ist aus einem Skript, das ich vor längerer Zeit auf AutoItScript.com gefunden habe und gerade ist mir eingefallen, dass @ChaosKeks hierin schonmal das Menü bewundert hat) Es ist eigentlich ein Beispiel für Hintergrundbild und transparenter Vordergrund. Die Technik müsste sich auch 1:1 in einem PopUpWindow das kein ParentWindow hat umsetzen lassen.

    Spoiler anzeigen
    [autoit]

    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseUpx=n
    #AutoIt3Wrapper_Run_Tidy=y
    ;#Tidy_Parameters=/gd /gds
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.0.0
    Author: AutoBert
    Script Function: Template for Transgui over JPG-Image

    #ce ----------------------------------------------------------------------------

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

    #include <GUIConstants.au3>
    #include <WindowsConstants.au3>
    #include <ProgressConstants.au3>
    #include <Constants.au3>
    #include <StaticConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #include <GuiImageList.au3>
    #include <GuiTreeView.au3>
    #include <EditConstants.au3>
    #include<ButtonConstants.au3>
    #include <GuiListView.au3>
    #include <GuiTab.au3>

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

    Opt("GUIOnEventMode", 1) ;ONEvent Mode.
    ;Opt("TrayMenuMode", 1)
    Global $hfrmMain, $hfrmChild, $hlblfilemenu, $hjpgBckgrnd, $hlblFileContext, $hFileContext, $hsldrPercent

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

    Global $iWidht = 1024, $iHeight = 550, $hWinToMove
    _Main()

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

    Func _Main()
    HotKeySet("{F6}", "hide")
    $hfrmMain = GUICreate("TRANS", $iWidht, $iHeight, 0, 0, $WS_POPUP, $WS_EX_CLIENTEDGE)
    GUISetState(@SW_HIDE, $hfrmMain)
    $hjpgBckgrnd = GUICtrlCreatePic("bin\bg" & Random(1, 8, 1) & ".jpg", 0, 0, 1024, 600) ;change bgX.jpg with your jpeg
    Local $hpbarPercent = GUICtrlCreateProgress(0, 570, $iWidht, 30, $PBS_SMOOTH)
    DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", 0, "wstr", 0)

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

    $hfrmChild = GUICreate("GUI", $iWidht, $iHeight, -1, -1, $WS_POPUP, $WS_EX_MDICHILD, $hfrmMain)
    GUISetFont(-1, 10, 800)
    WinSetTrans("GUI", "", 0)
    WinSetOnTop("GUI", "", 1)
    GUISetState(@SW_SHOW, $hfrmChild)
    $hclose = GUICtrlCreateIcon("bin\close.ico", $iHeight - 8, $iWidht - 18, 5, 16, 16)
    GUICtrlSetOnEvent($hclose, "_exitMain")

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

    $hlblPercent = GUICtrlCreateLabel("0", 492, 570, 60, 30)
    GUICtrlSetFont(-1, 10, 800)
    ;------------------------MENU FILE
    $hlblfilemenu = GUICtrlCreateLabel("&Datei", 3, 4, 45, 15)
    GUICtrlSetOnEvent(-1, "_ShowFileMenu")
    GUICtrlSetFont(-1, 10, 800)
    $filesDummy = GUICtrlCreateDummy()
    $hFileContext = GUICtrlCreateContextMenu($filesDummy)
    $fileopen = GUICtrlCreateMenuItem("&Hintergrund", $hFileContext)
    GUICtrlSetOnEvent(-1, "_OpenJPG")
    GUICtrlCreateMenuItem("", $hFileContext)
    $OptionsExit = GUICtrlCreateMenuItem("Be&enden", $hFileContext)
    GUICtrlSetOnEvent(-1, "_ExitMain")

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

    #cs
    ;--------------------Menu EDIT
    $editmenu = GUICtrlCreateLabel("&Bearbeiten", 53, 4, 75, 15)
    GUICtrlSetFont(-1, 10, 800)
    $editDummy = GUICtrlCreateDummy()
    $editContext = GUICtrlCreateContextMenu($editDummy)
    $editcopy = GUICtrlCreateMenuItem("&Kopieren", $editDummy)
    $editpaste = GUICtrlCreateMenuItem("&Einfügen", $editDummy)
    #ce

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

    ;---------------------MENU HELP
    $helpmenu = GUICtrlCreateLabel("&Hilfe", 138, 4, 45, 15)
    GUICtrlSetFont(-1, 10, 800)
    $HelpDummy = GUICtrlCreateDummy()
    $HelpContext = GUICtrlCreateContextMenu($HelpDummy)
    $HelpWWW = GUICtrlCreateMenuItem("Website", $HelpContext)
    GUICtrlCreateMenuItem("", $HelpContext)
    $HelpAbout = GUICtrlCreateMenuItem("&Hilfe", $HelpContext)
    $helpregister = GUICtrlCreateMenuItem("&Lizenz", $HelpContext)

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

    ;-------------------LINE
    $line = GUICtrlCreateGraphic(0, 24, 1024, 2)
    GUICtrlSetGraphic($line, $GUI_GR_LINE, 0, 0)
    GUICtrlSetColor(-1, 0)
    ;-----------------ICONS
    $hicoFile = GUICtrlCreateIcon("shell32.dll", -100, 0, 30, 32, 32, $SS_SUNKEN)
    GUICtrlCreateIcon("shell32.dll", -4, 32, 30, 32, 32, $SS_SUNKEN)
    GUICtrlCreateIcon("shell32.dll", -7, 64, 30, 32, 32, $SS_SUNKEN)
    $btn = GUICtrlCreateButton("TEST", 450, 120, 120, 24)
    GUICtrlSetFont(-1, 10, 800)

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

    $hsldrPercent = GUICtrlCreateSlider(10, $iHeight - 30, $iWidht - 20, 30)
    GUICtrlSetLimit($hsldrPercent, 100, 50)
    GUICtrlSetFont(-1, 10, 800)
    ;WinSetOnTop("TRANS","",1)
    GUISetState(@SW_SHOW, $hfrmMain)
    GUISetState(@SW_SHOW, $hfrmChild)

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

    #cs
    for $iPercent= 0 to 100
    sleep(1)
    WinSetTrans ("GUI","",$a*2.55)
    GUICtrlSetData($hpbarPercent, $iPercent)
    GUICtrlSetData($w, $a& " %")
    next
    for $iPercent= 100 to 90 Step -1
    sleep(5)
    WinSetTrans ("GUI","",$a*2.55)
    GUICtrlSetData($hpbarPercent, $iPercent)
    GUICtrlSetData($w, $a& " %")
    next
    #ce
    ;GUICtrlDelete($w) ;Prozentanzeige

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

    GUICtrlSetData($hsldrPercent, 80)
    WinSetTrans("GUI", "", GUICtrlRead($hsldrPercent) * 2.55)
    While True
    $iPercent = GUICtrlRead($hsldrPercent) ; Ließt den aktuellen wert des Sliders aus.
    WinSetTrans("GUI", "", $iPercent * 2.55)
    Sleep(120)
    WEnd
    EndFunc ;==>_Main

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

    Func _exitMain()
    #cs
    for $iPercent= $iPercent to 100
    sleep(1)
    WinSetTrans ("GUI","",$iPercent*2.55)
    GUICtrlSetData($hpbarPercent, $iPercent)
    GUICtrlSetData($hlblPercent, $iPercent & " %")
    next
    #ce
    GUISetState(@SW_HIDE, $hfrmMain)
    Sleep(3)
    ;GUISetState(@SW_HIDE,$hfrmChild)
    GUIDelete($hfrmChild)
    GUIDelete($hfrmMain)
    Exit
    EndFunc ;==>_exitMain

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

    ; -------------- func
    Func hide()
    GUISetState(@SW_HIDE, $hfrmMain)
    GUISetState(@SW_HIDE, $hfrmChild)
    HotKeySet("{F6}", "show")
    EndFunc ;==>hide

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

    Func show()
    GUISetState(@SW_SHOW, $hfrmMain)
    GUISetState(@SW_SHOW, $hfrmChild)
    HotKeySet("{F6}", "hide")
    EndFunc ;==>show

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

    Func _OpenJPG()
    $sjpgBckgrnd = FileOpenDialog("Select a file", @ScriptDir & "\bin", "Images (*.jpg)", 1, "", $hfrmChild)
    GUICtrlSetImage($hjpgBckgrnd, $sjpgBckgrnd)
    EndFunc ;==>_OpenJPG

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

    Func _ShowFileMenu()
    ShowMenu($hfrmChild, $hlblfilemenu, $hFileContext)
    EndFunc ;==>_ShowFileMenu

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

    ;Show a menu in a given GUI window which belongs to a given GUI ctrl
    Func ShowMenu($hWnd, $CtrlID, $nContextID)
    Local $arPos, $x, $y
    Local $hMenu = GUICtrlGetHandle($nContextID)

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

    $arPos = ControlGetPos($hWnd, "", $CtrlID)

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

    $x = $arPos[0]
    $y = $arPos[1] + $arPos[3]

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

    ClientToScreen($hWnd, $x, $y)
    TrackPopupMenu($hWnd, $hMenu, $x, $y)
    EndFunc ;==>ShowMenu

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

    ; Convert the client (GUI) coordinates to screen (desktop) coordinates
    Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

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

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

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

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

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

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
    EndFunc ;==>ClientToScreen

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

    ; Show at the given coordinates (x, y) the popup menu (hMenu) which belongs to a given GUI window (hWnd)
    Func TrackPopupMenu($hWnd, $hMenu, $x, $y)
    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0)
    EndFunc ;==>TrackPopupMenu

    [/autoit]


    Du benötigst für zusätzlich einen Ordner mit den Hintergrundbildern falls du die Transparenz nutzen will.
    Ich hoffe, dass dir dieser Weg mehr zusagt. Ich werde mich nächste Woche auch damit beschäftigen,

    mfg (Auto)Bert

  • [dummy-mode-hoch2]Wie soll mir das denn helfen, die Spaces, die ich brauche, rauszukriegen?[/dummy-mode-hoch2]
    Sry, dass ich so lästig bin!

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Hallo tobi_girst,

    [dummy-mode-hoch2]Wie soll mir das denn helfen, die Spaces, die ich brauche, rauszukriegen?[/dummy-mode-hoch2]
    Sry, dass ich so lästig bin!

    dies ist ein ganz anderer Ansatz, aber wenn du zu bequem bist dir das Skript anzuschauen kann ich dir auch nicht weiterhelfen,

    mfg (Auto)Bert

  • Sry für'n Doppelpolst, aber ich hab jetzt eine Möglichkeit gefunden.

    [autoit]

    $size = WinGetPos ("DoubleFileBrowser 1.0")
    $menuwidth = $size [2] / 3
    GUICtrlSetData ($about, $menuwidth)

    [/autoit]

    Aber wie krieg ich die Zahl jetzt auf die Leerzeichen??
    MfG. tobi_girst
    PS:Wenn das nicht geht, dann lass ichs! nicht : D

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Hallo tobi_girt,

    Lösung für dummy_methode1:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include<string.au3>

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

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("DoubleFileBrowser 1.0", 633, 447, 193, 125)
    $MenuItem1 = GUICtrlCreateMenu("Datei")
    $MenuDummy= GUICtrlCreateMenu(" ")
    GUICtrlSetState(-1, $GUI_DISABLE)
    $about = GUICtrlCreateMenu("Hilfe")
    $size = WinGetPos ("DoubleFileBrowser 1.0")
    $menuwidth = $size [2] / 3 / 1.4
    GUICtrlSetData ($MenuDummy, _StringRepeat(' ',Floor($menuwidth)))
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

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

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

    EndSwitch
    WEnd

    [/autoit]

    musste die Zahl noch mit einem Faktor korrigieren,

    Edit1: im Spoiler noch MenuDummy auf disabled gestellt, auf evtl. Resizen des Fensters must du noch ragieren

    mfg (Auto)Bert

    Einmal editiert, zuletzt von AutoBert (23. Mai 2009 um 23:26)