Collapsible Gui Window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

Collapsible Gui Window

Post by HeXaDeCiMaToR » 22 Feb 2021, 10:42

Is there a way to set a gui format to collapse the window down to the menu bar unless I mouse over the menu bar?
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Collapsible Gui Window

Post by Hellbent » 22 Feb 2021, 10:58

You mean like this?

*Assumes that your taskbar is at the bottom of your screen.

Code: Select all

#SingleInstance, force
SetBatchLines, -1
SysGet, Prime, MonitorPrimary
SysGet, Work , MonitorWorkArea , % Prime
Gui, 1:Show, w300 h300
Gui, 1:Minimize
SetTimer, WatchCursor, 300
return
GuiClose:
GuiContextMenu:
*ESC::ExitApp

WatchCursor:
	CoordMode, Mouse, Screen
	MouseGetPos, , y
	if( !Active && y > WorkBottom && Active := 1 )
		Gui, 1:Show
	else if( Active && y < WorkBottom && ! Active := 0 )
		Gui, 1:Minimize
	return
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

Re: Collapsible Gui Window

Post by HeXaDeCiMaToR » 23 Feb 2021, 00:38

So, I have to apologize. When I said "menu bar" I meant the "title bar". Minimizing the program until I mouse over a section of the screen could be problematic, and the other thread dealing with this doesn't look to have any current leads either. If you think of anything else, lmk. I'll post any results if I find them.

"Actual Roll Up" claims to be able to do it. So I know it CAN be done...
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

Re: Collapsible Gui Window

Post by HeXaDeCiMaToR » 23 Feb 2021, 01:08

This worked like a charm!

I had to place different parts of the script in specific areas of my script for it the work, but it's doing exactly what I want.

https://www.autohotkey.com/docs/scripts/index.htm#WindowShading
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Collapsible Gui Window

Post by Hellbent » 23 Feb 2021, 02:22

Oh, ok so you were going for something like this.
temp.gif
temp.gif (150.34 KiB) Viewed 784 times
Well if you have it all figured out, I wish you luck with your project.
HeXaDeCiMaToR
Posts: 155
Joined: 08 Feb 2021, 12:42

Re: Collapsible Gui Window

Post by HeXaDeCiMaToR » 26 Feb 2021, 06:29

I didn't want mouseover activation as I'll be working in the area of my screen that I currently have my gui sitting often. I really wanted a doubleclick on the title bar to activate the action. HOWEVER...., that mouse over to activate when on the left side like you show in your gif is clean and out of the way.

Is there a way to have it hide with just a colored "snipit" (looks like yours is green when the gui is "hidden"), "show" during mouseover, AND have a way to prop it open (visible) with a checkbox in the title bar (I have functions that may bring my mouse away from the gui and I'll want the information shown in the add/edit box visible). How does one achieve that level of kung fu mastery?

If there's not a simple way to prop the window to "visible", how would one go about doing what you have shown in your gif?

Right now I'm using ^LButton to activate the "hide all but the toolbar" function. Which is... "fine", but I have to first make the gui the active window and THEN I can initiate the trigger.

Also, Thanks for all of your tutorials, HB! I saw your collaboration vid with J.Glines and I've used a lot of your tuts to help me get as far as have! Which I'm sure is still VERY elementary compared to the gui scripts you're creating, but it's accomplishing my current "needs" lol
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Collapsible Gui Window

Post by Hellbent » 26 Feb 2021, 08:59

I'm a bit strapped for time atm but here is a concept that I was playing around with a few years ago.

How to use:

Run the script and move your mouse to the top of the screen and then away.

With your mouse over the window Right click to toggle the lock

once locked the window will remain in its tab size.

You can click and drag the tab to change it's position.

Code: Select all

#SingleInstance,Force
SetTitleMatchMode,2
SetBatchLines,-1
global is_Active:=1 ,Slider_Color:="1144aa" ,Lock_State:=0,Moving_Slider:=0,O_Window:=WinExist("ahk_class SciTEWindow") ;ahk_class Chrome_WidgetWin_1 ; ahk_class SciTEWindow

Gui,1: -Caption -DPIScale +LastFound +AlwaysOnTop
Gui,1:Color,123456
Gui,2:Color,222222
Gui,2:Font,cWhite s12 Bold Q5
Gui,2:+Parent1 -Caption -DPIScale 
WinSet,Transcolor,123456

Gui,1:Add,Text,x375 y90 w50 h10  vTab_Slider_1 gMove_Slider
Gui,1:Add,Progress,x375 y90 w50 h10 Background%Slider_Color% vTab_Slider_2

Gui,1:Show, y0 w800 h100,HB Slide
Gui,2:Show, x0 y0 w800 h90

SetTimer,Watch_Mouse,300

return
GuiClose:
*ESC::ExitApp

Watch_Mouse:
	CoordMode,Mouse,Screen
	MouseGetPos,tx,ty
	if(ty>100&&is_Active=1&&tx<1366&&Moving_Slider=0){
		Gui,1:Show,y-90 NA
		is_Active:=0
		if(Lock_State)
			SetTimer,Watch_Mouse, Off
	}
	else if(ty<100&&is_Active=0&&tx<1366&&Lock_State=0&&Moving_Slider=0){
		Gui,1:Show,y0 NA
		is_Active:=1
	}
	
	return

Move_Slider:
	CoordMode,Mouse,Window
	Moving_Slider:=1
	while(GetKeyState("LButton"))
		{
			MouseGetPos,ttx
			if(ttx>25&&ttx<775){
				GuiControl,1:Move,Tab_Slider_1,% "x" ttx-25
				GuiControl,1:Move,Tab_Slider_2,% "x" ttx-25
			}else if(ttx<25){
				GuiControl,1:Move,Tab_Slider_1,x0
				GuiControl,1:Move,Tab_Slider_2,x0
			}else if(ttx>775){
				GuiControl,1:Move,Tab_Slider_1,x750
				GuiControl,1:Move,Tab_Slider_2,x750
			}
		}
	Moving_Slider:=0	
	return


GuiContextMenu:
2GuiContextMenu:
	if(Lock_State:=!Lock_State){
		GuiControl,1:+Background992222,Tab_Slider_2
	}else{
		
		GuiControl,1:+Background1144aa,Tab_Slider_2
		SetTimer,Watch_Mouse, On
	}
	return


As for fading the window in and out. Have a look at how it is done here to get some insights.

https://www.autohotkey.com/boards/viewtopic.php?f=76&t=87039#p382824

HTH
Last edited by Hellbent on 26 Feb 2021, 09:25, edited 1 time in total.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Collapsible Gui Window

Post by Hellbent » 26 Feb 2021, 09:06

If you only want to switch between a small tab sized window and normal size you can have a look at these examples as something to draw from.

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=68814&p=313634 ;CBMv2

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=71705 ;CPM1

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=60942 ;CP2
scriptor2016
Posts: 854
Joined: 21 Dec 2015, 02:34

Re: Collapsible Gui Window

Post by scriptor2016 » 26 Feb 2021, 19:11

I slapped together this simple code years ago to roll up/roll down a GUI window. Maybe it's too simple but hey it did the trick for me. Pretty sure there's a way to get the button up on the title bar instead of inside the GUI itself, but it would be a little more work - but this could be a start. Just an idea, maybe it can help you out :)

Code: Select all

coordmode, mouse, screen

Gui, 1: +AlwaysOnTop
Gui, 1: Add, Button, x0 y1 w50 h20 Center gClick
Gui, 1: Show, x500 y500 w500 h400, ROLL_UP_TEST
Return

Click:
WinGetPos, x, y, w, h, ROLL_UP_TEST
If h > 50
{       
Winmove, ROLL_UP_TEST,, %x%, %y%, %w%, 50
}
else
{
Winmove, ROLL_UP_TEST,, %x%, %y%, %w%, 400
}
Return
Post Reply

Return to “Ask for Help (v1)”