Statusbar

  • Hallo Leute,
    ich hab mal eine Frage zu einer Statusbar.

    In meinen Script hab ich eben eine Statusbar mit 3 Teilabschnitten erstellt.
    In dem ersten wird die Spieldauer des Liedes angezeigt
    in dem zweiten die BPM des Liedes,
    und im letzten das Volumen.

    So meine Frage ist es möglich egal ob über GuiGetMsg oder GUICtrlSetOnEvent ( bei mir hat das nicht geklappt) oder irgendwelchen anderen Tricks
    die mir nocht bekannt sind irgendwie festzustellen ob der User daraufgeklickt hat. Wenn ja das soll ein kleiner Slider erscheine, mit dem man die jeweilige Einheit einstellen kann.

    Ich habs zwar schon mit GUIGetCursorInfo gearbeitet, aber die Lösung die ich habe ist extrem umständlich.

    Hier mal meine Lösung

    Spoiler anzeigen
    [autoit]


    #include <Constants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiStatusBar.au3>

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

    #include <SliderConstants.au3>

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

    Dim $Form = GUICreate("", 538, 267, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
    Dim $hVol, $hVolSlider
    Dim $part[15] = [68, 93, 118, 143, 205, 250, 350, 381, 382]

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

    $Statusbar = _GUICtrlStatusBar_Create($Form, $part)
    $hStatusbar = GUICtrlGetHandle($Statusbar)
    _GUICtrlStatusBar_SetText($Statusbar, "Loaded...")

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

    _GUICtrlStatusBar_SetText($Statusbar, "00:00:00", 4)
    _GUICtrlStatusBar_SetText($Statusbar, "VOL", 5)
    _GUICtrlStatusBar_SetText($Statusbar, "BPM", 6)

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

    GUISetState()

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

    While 1

    Dim $aInfo = GUIGetCursorInfo($Form);, $iOldHoverID = 0;MouseHover
    If @error Then MsgBox(0, "Error: " & @error, "I´m sorry, the app has a problem with the calculation of the MousePos.")

    If $aInfo[1] > 232 And $aInfo[1] < 267 And $aInfo[2] = 1 Then
    If $aInfo[0] > 205 And $aInfo[0] < 250 Then
    If $hVol = False Then
    $pos = WinGetPos($Form)
    $hVol = GUICreate("", 50, 100, $pos[0] + $aInfo[0], $pos[1] + $aInfo[1] + 25, $WS_POPUP, $WS_EX_TOPMOST)
    $hVolSlider = GUICtrlCreateSlider(0, 0, 50, 100, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH, $TBS_NOTICKS))
    GUISetState(@SW_SHOW, $hVol)
    EndIf
    EndIf
    Elseif $aInfo[1] < 232 And $aInfo[1] > 267 And $aInfo[2] = 1 Then ;wenn nicht gerade darauf geklcikt wird dann sollen die GUIS gelöscht werden
    If $hVol then GUIDelete($hVol)
    EndIf
    WEnd ;==>_MouseHover

    [/autoit]

    Thx für erue Idess

  • Spoiler anzeigen
    [autoit]


    #include <Constants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <StaticConstants.au3>
    #include <GuiStatusBar.au3>

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

    #include <SliderConstants.au3>
    Dim $Form = GUICreate("", 538, 267, -1, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE))
    Dim $hVol, $hVolSlider
    Dim $part[15] = [68, 93, 118, 143, 205, 250, 350, 381, 382]

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

    $Statusbar = _GUICtrlStatusBar_Create($Form, $part)
    _GUICtrlStatusBar_SetText($Statusbar, "Loaded...")

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

    _GUICtrlStatusBar_SetText($Statusbar, "00:00:00", 4)
    _GUICtrlStatusBar_SetText($Statusbar, "VOL", 5)
    _GUICtrlStatusBar_SetText($Statusbar, "BPM", 6)

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

    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

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

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

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

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $Statusbar
    Switch $iCode
    Case $NM_CLICK
    Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
    $ItemSpec = DllStructGetData($tinfo, "ItemSpec")
    Switch $ItemSpec
    Case 4
    MsgBox(0, 0, "Klick auf Timer")
    Case 5
    MsgBox(0, 0, "Klick auf VOL")
    Case 6
    MsgBox(0, 0, "Klick auf BPM")
    EndSwitch
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

    [/autoit]