Jump to content

Reserving desktop space for sidebar gui?


Go to solution Solved by ioa747,

Recommended Posts

Posted

Hello again.

I'm trying to create a sidebar gui. Creating the gui is simple enough, (permanently) reserving the desktop space is the problem.

I searched all the sidebar (or taskbar like) related posts, but don't see anything about reserving space. Resizing each and every window that opens is likely to be a pain.

One possibility, is there perhaps a reg key that sets the maximum window size or width?

Posted (edited)

What I am trying to do is have a list of macro keys in the sidebar, see the attached screenshot.

The bar on the right-hand side is (the beginings of) my sidebar. The contents of the sidebar will depend on the active window. Running Office will display a different list of keys, and so on.

I use a Razer Tarturus as a macro pad. Thats around 120 keys available for each application that I might run. The bar in the screenshot is a list of keys and their commands.

I would like the sidebar to be constantly present. There are two ways of doing that:

1) Resize every windows that opens.

2) Reserve space for the sidebar. Forcing any windows that open fit between the taskbar and the sidebar.

Option 2 would be far easier. I just don't now any way to force all windows to open between the taskbar and the sidebar.

I hope all that makes sense.

Sorry about uploading pics, don't know how else to explain.

Screenshot.png

Edited by TwoCanoe
Apology
Posted
49 minutes ago, TwoCanoe said:

Sorry about uploading pics, don't know how else to explain.

Actually, thanks for that.
I could not make sense of what you wanted. Now I see what you're up to.

I don't have the answers you're looking for. If memory serves, it was possible in XP but don't remember where I've seen it ( here in this forum ).
And am not sure if the other program ( Notepad++ in this case ) would accept a max/min, just as you would with your own code.

It is a head scratcher ( for me anyway ).
I don't have the time to look into it but I'd try to make the other a child om a GUI of mine, if that don't work, then an API. Else, resize it when is maximized. 🤷‍♂️

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted

I have tried making the sidebar a child and resizing, but gets messy.

I also had a look at '_WinAPI_SystemParametersInfo' with '$SPI_GETWORKAREA' and '$SPI_SETWORKAREA', but not sure if that would work - way above my head!

In the meantime, I'll keep scratching...

  • Solution
Posted (edited)

There is definitely room for improvement (exploring the scrolling) and that's why I said it as an idea.
The idea where  you can use one of this type (auto-hide) where no extra space is needed (as its purpose is only to call a command)

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

Global $g_bAutoHide = True
Global $idBtnAutoHide
Global $g_hTriggerGUI, $g_hRibonGUI

;~ $g_hTriggerGUI = TriggerGUI()
$g_hTriggerGUI = TriggerGUI(0xF0F0F0, 15, 100, 250)
$g_hRibonGUI = RibonGUI()

;**********************************
While Sleep(50)
    TriggerCheck()
WEnd
;**********************************

;----------------------------------------------------------------------------------------
Func GoToExit()    ; exit
    Exit
EndFunc   ;==>GoToExit
;----------------------------------------------------------------------------------------
Func TriggerGUI($BkColor = 0xF0F0F0, $Width = 12, $Height = 50, $Trans = 50)
    Local $hWnd = GUICreate("TriggerGUI", $Width, $Height, -7, (@DesktopHeight - $Height) * 0.4, $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
    GUISetBkColor($BkColor)
    WinSetTrans($hWnd, "", $Trans)
    GUICtrlCreateLabel("", 0, 0, $Width, $Height)
    WinSetState($hWnd, "", @SW_SHOW)
    Return $hWnd
EndFunc   ;==>TriggerGUI
;----------------------------------------------------------------------------------------
Func TriggerCheck()

    ;if mouse over Trigger
    Local $aTrigger = GUIGetCursorInfo($g_hTriggerGUI)
    If $aTrigger[4] Then

        ;Make the RibonGUI
        Local $WinPos = WinGetPos($g_hRibonGUI)
        Local $BakPos = $WinPos
        WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $WinPos[2], $WinPos[3])
        GUISetState(@SW_SHOW, $g_hRibonGUI)

        ;Show the RibonGUI
        For $i = 1 To $WinPos[2] Step 5
            WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $i, $WinPos[3])
        Next
        Local $aRibon
        ;**********************************
        While 1
            $aRibon = GUIGetCursorInfo($g_hRibonGUI)
            If $aRibon[4] = 0 And $g_bAutoHide = True Then ExitLoop

            Sleep(100)
        WEnd
        ;**********************************

        ;Hide the RibonGUI
        For $i = $WinPos[2] To 1 Step -5
            WinMove($g_hRibonGUI, "", $WinPos[0], $WinPos[1], $i, $WinPos[3])
        Next
        GUISetState(@SW_HIDE, $g_hRibonGUI)
        WinMove($g_hRibonGUI, "", $BakPos[0], $BakPos[1], $BakPos[2], $BakPos[3])

    EndIf

EndFunc   ;==>TriggerCheck
;----------------------------------------------------------------------------------------
Func RibonGUI()   ; Ribon make

    Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled
    GUISetOnEvent($GUI_EVENT_CLOSE, "GoToExit")

    ConsoleWrite("@DesktopWidth=" & @DesktopWidth & @CRLF)
    ConsoleWrite("@DesktopHeight=" & @DesktopHeight & @CRLF)
    ConsoleWrite("@OSVersion=" & @OSVersion & @CRLF)
    ConsoleWrite("@AutoItX64=" & @AutoItX64 & @CRLF)

    Local $Width = 320
    Local $Height = @DesktopHeight - 40 ; $DTs[1]


    Local $hWnd = GUICreate("RibonGUI", $Width, $Height, -7, -1, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
    ; $idLblHead = GUICtrlCreateLabel("", 0, 0, $Width, 32)
    ; GUICtrlSetBkColor(-1, 0x004A7F)

    Local $iStep = 2

    $idBtnAutoHide = GUICtrlCreateButton("◀", $Width - 30, $iStep, 28, 28)
    GUICtrlSetFont(-1, 14)
    GUICtrlSetTip(-1, "Auto Hide ")
    GUICtrlSetOnEvent(-1, "Ribon_BtnAutoHide")

    $iStep += 50

    GUICtrlCreateLabel("$idInput1", 10, $iStep, 300, 15)
    $iStep += 15
    $idInput1 = GUICtrlCreateInput("Tex1", 10, $iStep, 305, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono")
    $iStep += 40
    GUICtrlCreateLabel("$idInput2", 10, $iStep, 300, 15)
    $iStep += 15
    $idInput2 = GUICtrlCreateInput("Tex2", 10, $iStep, 305, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono")
    $iStep += 40
    GUICtrlCreateLabel("$idInput3", 10, $iStep, 300, 15)
    $iStep += 15
    $idInput3 = GUICtrlCreateInput("Tex3", 10, $iStep, 305, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono")
    $iStep += 40
    GUICtrlCreateLabel("$idInput4", 10, $iStep, 300, 15)
    $iStep += 15
    $idInput4 = GUICtrlCreateInput("Tex4", 10, $iStep, 305, 22)
    GUICtrlSetFont(-1, 12, 400, 0, "DejaVuSansMono")


    GUICtrlCreateLabel("", 0, 0, $Width, $Height, $SS_GRAYFRAME)

    Return $hWnd
EndFunc   ;==>RibonGUI
;----------------------------------------------------------------------------------------
Func Ribon_BtnAutoHide()
    If $g_bAutoHide = True Then
        $g_bAutoHide = False
        GUICtrlSetData($idBtnAutoHide, "⏸️")
    Else
        $g_bAutoHide = True
        GUICtrlSetData($idBtnAutoHide, "◀️")
    EndIf
EndFunc   ;==>Ribon_BtnAutoHide
;----------------------------------------------------------------------------------------

 

Edited by ioa747
update

I know that I know nothing

Posted

Added the line argumentum added (after line 117). I now see a vertical bar in the SciTE number column, tried to hover over it, but nothing. Mouse cursor still had a life of its own.

Posted (edited)

ioa747. Tried the script you posted above. Mouse cursor is a lot better, but when I hover over the bar, I get a flickering bar a few pixels high and maybe 200 pixels wide.

Edited by TwoCanoe

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...