Is it possible to make this kind of Gui

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Is it possible to make this kind of Gui

19 May 2019, 05:26

The white part to move and the slider background to be gray
Using vertical Slider doesn't look right
Attachments
2019-05-19_112317.jpg
2019-05-19_112317.jpg (2.42 KiB) Viewed 5179 times
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Is it possible to make this kind of Gui

19 May 2019, 06:13

A standard slider from AHK's collection of GUI-controls will look different to your picture.
Use GDip to make a slider that matches the picture.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Is it possible to make this kind of Gui

19 May 2019, 07:03

Code: Select all

Gui New, +LastFound +AlwaysOnTop -Caption
Gui Color, Black
Gui Add, Progress, x27 y20 w11 h79 c0x6B696A Background0x6B696A, 100
Gui Add, Progress, x27 y74 w11 h11 c0xFFFFFF Background0xFFFFFF, 100
Gui Font, s10 q5, Segoe UI
Gui Add, Text, x25 y107 c0xFFFFFF, 20
Gui Show, w65 h140
WinSet Trans, 225
vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Is it possible to make this kind of Gui

19 May 2019, 07:39

Thanks but I have some problems.
1.Is there is a way to center the text so when it is 1 or 3 digits to not look bad
2.Why this is not doing anything

NumpadAdd::
Var += 5
GuiControl,Move,vol,% "x27" "y" Var
Return

Vol is the variable given to the white progressbar
To make it look good,I can move it between y20 for 0 and y88 for 100,so I have to move the control by 6.8
Sam_
Posts: 146
Joined: 20 Mar 2014, 20:24

Re: Is it possible to make this kind of Gui

21 May 2019, 17:04

Wouldn't it just be easier to Center align the text control?

Code: Select all

Gui Add, Text, x25 y107 Center c0xFFFFFF, 20
To specify more than one option, include a space between each (note the space after 27 and before y):

Code: Select all

GuiControl,Move,vol,% "x27 " "y" Var
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: Is it possible to make this kind of Gui

14 Nov 2019, 13:48

Great idea swagfag!
Any idea how to make a working slider like this? For example to be able to replace the ListView native slider?
User avatar
SuperFoobar
Posts: 83
Joined: 23 Nov 2018, 15:14

Re: Is it possible to make this kind of Gui

14 Nov 2019, 14:27

think wrote:
14 Nov 2019, 13:48
Great idea swagfag!
Any idea how to make a working slider like this? For example to be able to replace the ListView native slider?
I tried to come up with something!

Code: Select all

Gui New, +LastFound +AlwaysOnTop -Caption
Gui Color, Black
Gui Add, Progress, x27 y20 w11 h79 c0x6B696A Background0x6B696A, 100
Gui Add, Progress, hwndSliderHandle x27 y74 w11 h11 c0xFFFFFF Background0xFFFFFF, 100
Gui Font, s10 q5, Segoe UI
Gui Add, Text, x25 y107 c0xFFFFFF, 20
Gui Show, w65 h140

fn := Func("MouseMove").Bind(SliderHandle)

;MouseMove
OnMessage(0x200, fn)

WinSet Trans, 225

MouseMove(SliderHandle) { ; move window
	If !GetKeyState("Lbutton", "P") 
		Return

	CoordMode, Mouse, Client
	MouseGetPos, mouseX, mouseY

	ControlGetPos, conX, conY, conW, conH, , % "ahk_id " SliderHandle

	If (mouseY > conY + conH) OR (mouseY < ConY)
		Return

	GuiControl, Move, % SliderHandle, %  "y" mouseY - (conH / 2)
}
@swagfag the accuracy of your gui to the original is very close!
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: Is it possible to make this kind of Gui

15 Nov 2019, 17:02

Thank you. I wonder if there is a way to avoid it getting stuck when mouse movement is too fast...
User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: Is it possible to make this kind of Gui

16 Nov 2019, 11:26

Code: Select all

Gui New, +LastFound +AlwaysOnTop -Caption ;-DPIScale
Gui Color, Black
Gui Add, Progress, x27 y20 w11 h79 c0x6B696A Background0x6B696A, 100
Gui Add, Progress, hwndSliderHandle x27 y74 w11 h11 c0xFFFFFF Background0xFFFFFF, 100
Gui Font, s10 q5, Segoe UI
Gui Add, Text, x25 y107 c0xFFFFFF, 20
Gui Show, w65 h140

fn := Func("MouseMove").Bind(SliderHandle)

;MouseMove
OnMessage(0x200, fn)
OnMessage(0x201, fn)

WinSet Trans, 225

MouseMove(SliderHandle) { ; move window
    Global
	If !GetKeyState("Lbutton", "P") 
		Return

	CoordMode, Mouse, Client
	MouseGetPos, mouseX, mouseY

	ControlGetPos, conX, conY, conW, conH, , % "ahk_id " SliderHandle

	;If (mouseY > conY + conH) OR (mouseY < ConY)
		;Return
    GuiControl, Move, % SliderHandle, %  "y" mouseY - (conH / 2)
}
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Is it possible to make this kind of Gui

16 Nov 2019, 15:08

Here is a functional slider.

Code: Select all

#SingleInstance,Force
global Active := 0
Gui New, +LastFound +AlwaysOnTop -Caption ;-DPIScale
Gui Color, Black
Gui Add, Progress, x27 y20 w11 h79 Background0x6B696A cDDAE00 Range0-68 Vertical hwndSliderBackground,0
Gui Add, Progress, hwndSliderHandle x27 y88 w11 h11 c0xFFFFFF Background0xFFFFFF, 100
Gui Font, s10 q5, Segoe UI
Gui Add, Text, x0 y107 w65 h22 c0xFFFFFF Center HwndDisplayText,0
Gui Show, w65 h140

fn := Func("MouseMove").Bind(SliderBackground,SliderHandle)

OnMessage(0x201,fn)

return

GuiContextMenu:
*ESC::
    ExitApp

Adjust_Slider:
    if(GetKeyState("LButton")){
        
        CoordMode,Mouse,Client
        
        MouseGetPos,,ty
        
        (ty<20)?(ty:=20):(ty>88)?(ty:=88)
        
        ButtonValue:=((ty-20)*-1)+68, Active:=1
        
        GuiControl,,% SliderBackground,% ButtonValue
        
        GuiControl,MoveDraw,% SliderHandle,%  "y" ty
        
        GuiControl,,% DisplayText,% ButtonValue
        
    }else   {
        
        SetTimer,Adjust_Slider,Off
        
        Active:=0
        
        SoundBeep,% 400 + (10 * ButtonValue)
        
        return
        
    }
    return

MouseMove(SliderBackground,SliderHandle) { 
    
    MouseGetPos,,,,ctrl,2
    
    if(!Active&&(ctrl=SliderBackground||ctrl=SliderHandle))
        
        SetTimer,Adjust_Slider,100
        
}

test gif 1.gif
test gif 1.gif (223.46 KiB) Viewed 4589 times
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: Is it possible to make this kind of Gui

17 Nov 2019, 12:42

Thanks, it's getting better and better. :)
Any idea how to also simulate the slider movement when the mouse is pressed above or below the handle (like with the real slider)?
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Is it possible to make this kind of Gui

17 Nov 2019, 18:18

think wrote:
17 Nov 2019, 12:42
Any idea how to also simulate the slider movement when the mouse is pressed above or below the handle (like with the real slider)?
Is this what you're talking about?

Code: Select all

#SingleInstance,Force
global Active:=0
Interval := 5, ButtonValue := 0
Gui New, +LastFound +AlwaysOnTop -Caption
Gui Color, Black
Gui Add, Progress, x27 y20 w11 h79 Background0x6B696A cDDAE00 Range0-68 Vertical hwndSliderBackground,0
Gui Add, Progress, hwndSliderHandle x27 y88 w11 h11 c0xFFFFFF Background0xFFFFFF, 100
Gui Font, s10 q5, Segoe UI
Gui Add, Text, x0 y107 w65 h22 c0xFFFFFF Center HwndDisplayText,0
Gui Show, w65 h140

fn := Func("MouseMove").Bind(SliderBackground,SliderHandle)
OnMessage(0x201,fn)
return

GuiContextMenu:
*ESC::
    ExitApp

Adjust_Slider:
	CoordMode,Mouse,Client
	MouseGetPos,,ty
	(ty<20)?(ty:=20):(ty>88)?(ty:=88)
	(Active=2)?((((ty-20)*-1)+68<=ButtonValue)?(ButtonValueNew:=Floor(ButtonValue/Interval)*Interval-Interval,Dir:=2):(ButtonValueNew:=Floor(ButtonValue/Interval)*Interval+interval,Dir:=1)):(ButtonValue:=((ty-20)*-1)+68 )
	if((((Dir=1&&88-ButtonValueNew>=ty)||(Dir=2&&88-ButtonValueNew<=ty))&&Active=2)||(Active=1&&ty!=oy)){
		GuiControl,,% SliderBackground,% (Active=2)?(ButtonValue:=ButtonValueNew):(ButtonValue)
		GuiControl,MoveDraw,% SliderHandle,% ((Active=2)?("y" 88-ButtonValue):("y" oy:=ty))
		GuiControl,,% DisplayText,% ButtonValue
	}
    return

#If (Active)
*LButton Up::
	SetTimer,Adjust_Slider,Off
	SoundBeep,% 400 + (10 * ButtonValue)+(Active:=0)
	return
#If

MouseMove(SliderBackground,SliderHandle) { 
    MouseGetPos,,,,ctrl,2
    if(ctrl=SliderHandle&&Active:=1){
        SetTimer,Adjust_Slider,100
		gosub,Adjust_Slider
	}else if(ctrl=SliderBackground&&Active:=2){
		SetTimer,Adjust_Slider,350
		gosub,Adjust_Slider
	}
}
test gif 1.gif
test gif 1.gif (157.18 KiB) Viewed 4502 times
think
Posts: 136
Joined: 09 Feb 2014, 05:20

Re: Is it possible to make this kind of Gui

18 Nov 2019, 03:43

Wow, thanks! I'll try to use this to create a custom ListView.
AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: Is it possible to make this kind of Gui

18 Nov 2019, 04:22

think wrote:
18 Nov 2019, 03:43
Wow, thanks! I'll try to use this to create a custom ListView.
when you are done pls share it with us
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: Is it possible to make this kind of Gui

30 Nov 2019, 17:59

think wrote:
18 Nov 2019, 03:43
Wow, thanks! I'll try to use this to create a custom ListView.
Have you done anything with it yet?

I've never actually used the default listview control yet so I thought it would be fun to try to create a custom one :crazy: .
This is the first draft of what I came up with.

there is enough now to move on to creating a prototype class to have it work as plug and play.

Code: Select all

/*
	Written By: Hellbent
	Date Started: Nov 30th, 2019
	Date Of Last Edit: 
	Custom Gui ListView based on topic: https://www.autohotkey.com/boards/viewtopic.php?f=76&t=64671
*/
#SingleInstance, Force
SetBatchLines, -1
SetControlDelay, -1
#NoEnv
ListLines, Off


global Active := 0 ; Context Hotkey Switch
global ActiveLevel := { pos: "" , type: "" }

Artist := ["KC and the Sunshine Band","Michael Jackson","Captain & Tennille","Queen","Pink Floyd","Blondie","Lipps, Inc.","Paul McCartney","Billy Joel","Olivia Newton-John","Christopher Cross","Diana Ross","Queen","Barbra Streisand","Kenny Rogers","John Lennon","Blondie","Kool & the Gang","Dolly Parton","Eddie Rabbitt","REO Speedwagon","Blondie","Daryl Hall and John Oates","Sheena Easton","Kim Carnes","Stars on 45","Air Supply","Rick Springfield","Diana Ross and Lionel Richie","Christopher Cross","Daryl Hall and John Oates","Olivia Newton-John"]
Song_Title := ["Please Don't Go","Rock with You","Do That to Me One More Time","Crazy Little Thing Called Love","Another Brick in the Wall (Part 2)","Call Me","Funkytown","Coming Up (Live at Glasgow)","It's Still Rock and Roll to Me","Magic","Sailing","Upside Down","Another One Bites the Dust","Woman in Love","Lady","(Just Like) Starting Over","The Tide Is High","Celebration","9 to 5","I Love a Rainy Night","Keep On Loving You","Rapture","Kiss on My List","Morning Train (Nine to Five)","Bette Davis Eyes","Stars on 45","The One That You Love","Jessie's Girl","Endless Love","Arthur's Theme (Best That You Can Do)","Private Eyes","Physical"]
Year := ["1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1980","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981","1981"]

global List1 := []

Loop,% Artist.length()	{
	List1[A_Index] := { Artist: 	Artist[A_Index] 
					  , SongTitle: 	Song_Title[A_Index]
					  , Year: 		Year[A_Index] }
}

Artist := "" , Song_Title := "" , Year := ""


;~ global Plaque := {				  x : 
				 ;~ , 				  y :
				 ;~ , 				  w :
				 ;~ , 				  h :
				 ;~ , 	 BackgroundHwnd :
				 ;~ , 	  	TriggerHwnd :
				 ;~ , 		   TextHwnd	:
				 ;~ , 	BackgroundColor :
				 ;~ , 		  MainColor	:
				 ;~ , 		  TextColor	:
				 ;~ , 		 ItemAWidth :
				 ;~ , 		 ItemBWidth :
				 ;~ ,        ItemCWidth	:	}




;Vector scale
global Scale := A_ScreenDPI / 96

Gui, 1: +AlwaysOnTop -DPIScale +Resize
Gui, 1: Color , 23272A , 33373A
Gui, 1: Font , cAAAAAA s8 Bold Q5 , Segoe UI
Gui, 1: Margin , 3 * Scale , 3 * Scale

;ListTriggers
global Trigger := [] , Tips := ""
x := 60 * Scale, y := 25 * Scale
Loop, 10	{
	hwnd := GuiDesigner.AddTrigger( Gui_Name := 1 , x , y += 25 * Scale, w := 580 * Scale , h := 20 *Scale , Label := "ListItemClickEvent" , Index := A_Index)
	Trigger[hwnd] := A_Index
}

;UpArrow Trigger
global  Arrow := []
x := 665 * Scale , y := 20 * Scale , w := 50 * Scale , h := 50 * Scale
hwnd := GuiDesigner.AddTrigger( Gui_Name , x , y , w , h , Label := "ArrowScroll" )
Arrow[hwnd] := 1

;DownArrow Trigger
x := 665 * Scale , y := 251 * Scale , w := 50 * Scale , h := 50 * Scale
hwnd := GuiDesigner.AddTrigger( Gui_Name , x , y , w , h , Label := "ArrowScroll" )
Arrow[hwnd] := 2

;Slider Button Trigger 
global SliderButton := {}
x := 665 * Scale , y := 80 * Scale , w := 50 * Scale , h := 160 * Scale
GuiDesigner.AddTrigger( Gui_Name , x , y , w , h , Label := "AdjustSliderButton" )
x := 681 * Scale , y := 90 * Scale , w := 18 * Scale , h := 16 * Scale
hwnd := GuiDesigner.AddTrigger( Gui_Name , x , y , w , h , Label := "AdjustSliderButton" )
SliderButton.ButtonTrigger := hwnd

;Control Border.
GuiDesigner.Fill_Rectangle( Gui_Name , x := 3 , y := 3 , w := 724 * Scale , h := 314 * Scale , Color := "313233" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" , thickness := 1 )

;List Background
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x := 50 * Scale, y := 10 *Scale , w := 600 * Scale , h := 300 * Scale , Color := "444444" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "777777" , thickness := 1 )

;Slider Background
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x := 660 * Scale , y := 10 * Scale , w := 60 * Scale , h := 300 * Scale , Color := "444444" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "777777" , thickness := 1 )

;LV Background
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x := 55 * Scale , y := 45 * Scale , w := 590 * Scale , h := 260 * Scale , Color := "333333" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "777777" , thickness := 1 )

;Column Heading 1
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x := 80 *Scale , y := 17 * Scale , w := 133 * Scale , h := 20 * Scale , Color := "242629" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "f0f0f0" )
GuiDesigner.AddText( Gui_Name := 1 , x , y , w , h , Text := "Song Title")

;Column Heading 2
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x += w + 70 * Scale , y , w , h , Color := "242629" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "f0f0f0" )
GuiDesigner.AddText( Gui_Name := 1 , x , y , w , h , Text := "Artist(s)")

;Column Heading 3
GuiDesigner.Fill_Rectangle( Gui_Name := 1 , x += w + 70 *Scale , y , w , h , Color := "242629" )
GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := "f0f0f0" )
GuiDesigner.AddText( Gui_Name := 1 , x , y , w , h , Text := "Year")

;Position Background
GuiDesigner.Fill_Rectangle( Gui_Name , x := 10 * Scale , y := 10 *Scale , w := 30 * Scale , h := 300 * Scale , Color := "444444" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" , thickness := 1 )

;Number Boxes
global Positions := [] , cb := ["444400" , "004400"]
 y := 25 * Scale , cc := ["222222" , "111111"] 
Loop, 10	{
	GuiDesigner.Fill_Rectangle( Gui_Name , x := 15 * Scale , y += 25 * Scale , w := 20 * Scale , h := 20 * Scale , Color := cb [ Mod( A_Index , 2 ) + 1 ] )
	GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" , thickness := 1 )
	Positions[A_Index] := GuiDesigner.AddText( Gui_Name , x , y , w , h , Text := A_Index , 1 )
}

;Rows
global Row := [[0]] , Banner := []
x := 60 * Scale , y := 50 * Scale
Loop 10	{
	Banner[ A_index ] := GuiDesigner.Fill_Rectangle( 1 , x , y , w := 580 * Scale , h := 20 * Scale , Color := Black , Color2 := cb [ Mod( A_Index , 2 ) + 1 ] , 100 )
	;~ GuiDesigner.Draw_Outline( Gui_Name := 1 , x , y , w , h , Color := cc [ Mod( A_Index , 2 ) + 1 ] )
	Row[ A_Index , 1 ] := GuiDesigner.AddText( Gui_Name := 1 , x += 10 * Scale , y , w := 180 * Scale , h , Text := List1[ A_Index ].SongTitle , 0 )
	Row[ A_Index , 2 ] := GuiDesigner.AddText( Gui_Name , x += 220 * Scale , y , w , h , Text := List1[ A_Index ].Artist , 0 )
	Row[ A_Index , 3 ] := GuiDesigner.AddText( Gui_Name , x += w , y , w , h , Text := List1[ A_Index ].Year  )
	x := 60 * Scale , y += 25 * Scale
}

;Up Arrow
x := 665 * Scale , y := 20 * Scale , w := 50 * Scale , h := 50 * Scale
GuiDesigner.Fill_Rectangle( Gui_Name , x , y , w , h , Color := "23272A" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" )
GuiDesigner.AddText( Gui_Name , x , y , w , h , Text := "UP" , 1 )

;Down Arrow
x := 665 * Scale , y := 251 * Scale , w := 50 * Scale , h := 50 * Scale
GuiDesigner.Fill_Rectangle( Gui_Name , x , y , w , h , Color := "23272A" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" )
GuiDesigner.AddText( Gui_Name , x , y , w , h , Text := "DOWN" , 1 )

;Slider Track
x := 665 * Scale , y := 80 * Scale , w := 50 * Scale , h := 160 * Scale
GuiDesigner.Fill_Rectangle( Gui_Name , x , y , w , h , Color := "23272A" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "777777" )
x := 688 * Scale , y := 90 * Scale , w := 4 * Scale , h := 140 * Scale   
GuiDesigner.Fill_Rectangle( Gui_Name , x , y , w , h , Color := "777777" )
GuiDesigner.Draw_Outline( Gui_Name , x , y , w , h , Color := "AAAAAA" )

;Slider Button
x := 681 * Scale , y := 90 * Scale , w := 18 * Scale , h := 16 * Scale
Gui, 1: Add , Progress , % "x" X " y" Y " w" W " h" H " hwndhwnd BackgroundAAAAAA c777777" , 100
SliderButton.ButtonpBar := hwnd
Gui, 1: Add , Text , % " c23272A x" X " y" Y " w" W " h" H " hwndhwnd BackgroundTrans Center 0x200" , =
SliderButton.ButtonText := hwnd

;Extra default controls.
;~ Alist := "KC and the Sunshine Band|Michael Jackson|Captain & Tennille|Queen|Pink Floyd|Blondie|Lipps, Inc.|Paul McCartney|Billy Joel|Olivia Newton-John|Christopher Cross|Diana Ross|Queen|Barbra Streisand|Kenny Rogers|John Lennon|Blondie|Kool & the Gang|Dolly Parton|Eddie Rabbitt|REO Speedwagon|Blondie|Daryl Hall and John Oates|Sheena Easton|Kim Carnes|Stars on 45|Air Supply|Rick Springfield|Diana Ross and Lionel Richie|Christopher Cross|Daryl Hall and John Oates|Olivia Newton-John"
;~ Slist := "Please Don't Go|Rock with You|Do That to Me One More Time|Crazy Little Thing Called Love|Another Brick in the Wall (Part 2)|Call Me|Funkytown|Coming Up (Live at Glasgow)|It's Still Rock and Roll to Me|Magic|Sailing|Upside Down|Another One Bites the Dust|Woman in Love|Lady|(Just Like) Starting Over|The Tide Is High|Celebration|9 to 5|I Love a Rainy Night|Keep On Loving You|Rapture|Kiss on My List|Morning Train (Nine to Five)|Bette Davis Eyes|Stars on 45|The One That You Love|Jessie's Girl|Endless Love|Arthur's Theme (Best That You Can Do)|Private Eyes|Physical"
;~ Ylist := "1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1980|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981|1981"
;~ Gui,1:Add,ListBox,% "x" 20 * Scale " y" 330 * Scale " w" 300 * Scale " h" 200 * Scale , % Alist
;~ Gui,1:Add,ListBox,% "x" 340 * Scale " y" 330 * Scale " w" 300 * Scale " h" 200 * Scale , % Slist
;~ Gui,1:Add,ListBox,% "x" 660 * Scale " y" 330 * Scale " w" 300 * Scale " h" 200 * Scale , % Ylist
;~ Gui,1:Add,Button,% "x" 760 * Scale " y" 284 * Scale " w" 190 * Scale " h" 30 * Scale " -Theme gGuiClose" , Exit Application
;~ Alist := "" , Slist := "" , Ylist := ""

;Show the window.
Gui,1:Show,Maximize,Custom ListView

;Exit Auto-Execute.
return
GuiClose:
GuiContextMenu:
*ESC::
	ExitApp

ToolTipsOff:
	SetTimer, ToolTips , Off
	ToolTip,
	return

ListItemClickEvent(hwnd){
	
	
	GuiControlGet, txt , 1:  , % Positions[1]
	Color3 := cb [ Mod( Trigger[ hwnd ] , 2 ) + 1 ]
	;~ Color4 := cb [ Mod( Trigger[ hwnd ] , 2 ) ]
	if(ActiveLevel.toggle = 1 ){
		if( ( Trigger[ hwnd ] ) = ActiveLevel.pos ){
			ActiveLevel := { pos: "" , toggle : 0 , Index : "" }
			GuiControl,1: +c%color3% , % Banner[ Trigger[ hwnd ] ]
		}else if( ( Trigger[ hwnd ] ) != ActiveLevel.pos ){
			GuiControl,1: +c336699 , % Banner[ Trigger[ hwnd ] ]
			GuiControl,1: +c%color3% , % Banner[ ActiveLevel.pos ]
			RedrawList( ActiveLevel.pos , ActiveLevel.index )
			ActiveLevel := { pos: Trigger[ hwnd ] , toggle : 1 , Index : Trigger[ hwnd ] - 1 + txt }
		}
	}else	{
		ActiveLevel := { pos: Trigger[ hwnd ] , toggle : 1 , Index : Trigger[ hwnd ] - 1 + txt }
		GuiControl,1: +c336699 , % Banner[ Trigger[ hwnd ] ]
	}
	RedrawList( Trigger[ hwnd ] , Trigger[ hwnd ] - 1 + txt )
	ToolTip,% Tips := "Song Title:           " List1[ Trigger[ hwnd ] - 1 + txt ].SongTitle "`nArtist:                    " List1[ Trigger[hwnd] - 1 + txt ].Artist "`nYear:                     " List1[ Trigger[hwnd] - 1 + txt ].Year
	SetTimer, ToolTipsOff , -1500
	SetTimer, ToolTips , 30
	return
}
ToolTips(){
	ToolTip,% Tips
	
	

}

;Slider clicked.
AdjustSliderButton(){
	Active := 1
	SetTimer,RepositionSlider,200
	RepositionSlider()
}

;Adjust slider button position and output value.
RepositionSlider(){
	static oy
	CoordMode, Mouse , Client
	MouseGetPos,,ty
	
	;Bounds
	( ty  < 100 * Scale ) ? ( ty := 100 * Scale ) : ( ty > 225 * Scale ) ? ( ty := 225 * Scale )
	
	;move the button
	RedrawSlider(ty)
	
	;update listview positions
	NewValue := floor( ( ty - 100 * Scale ) /  ( ( 130 * Scale ) / ( List1.Length() - 10 ) ) )
	( ty = 100 * scale ) ? ( NewValue := 0 ) : ( ty = (225 * Scale) ) ? ( NewValue := List1.Length() - 10 ) 
	if( NewValue < 23 && ty != oy ){
		
		oy := ty
		
		;Reposition Lists
		Loop, 10	{
			RedrawList( A_Index , NewValue + A_Index )
			Sleep, 10
		}
	}
}

#If (Active)

*LButton Up::
	SetTimer, RepositionSlider , Off
	Active := 0
	return

#If

ArrowScroll(hwnd){
	GuiControlGet, tempText , 1:  , % Positions[ 10 ]
	GuiControlGet, tempText2 , 1:  , % Positions[ 1 ]
	if( ( Arrow[ hwnd ] = 1 && temptext2 > 1 ) || ( Arrow[ hwnd ] = 2 && temptext < List1.Length() ) ){
		Loop, 10	{
			Value := ( Arrow[ hwnd ] = 1 ) ? ( temptext2 - 2 + A_Index ) : ( temptext2  + A_Index )
			RedrawList( A_Index , Value )
			Sleep, 10
		}
		out := ( Value * ( ( 130 * Scale ) / ( List1.Length() - 10 ) ) ) + ( 35 * Scale )
		RedrawSlider(out)
	}
}

RedrawSlider(Input){
	GuiControl, 1: MoveDraw , % SliderButton.ButtonTrigger , % " y" Input - 10 * Scale
	GuiControl, 1: MoveDraw , % SliderButton.ButtonpBar , % " y" Input - 10 * Scale
	GuiControl, 1: MoveDraw , % SliderButton.ButtonText , % " y" Input - 10 * Scale
}

RedrawList(dex,posi){
	GuiControl, 1: , % Positions[ dex ] , % posi
	GuiControl, 1: , % Row[ dex , 1 ] , % List1[ posi ].SongTitle
	GuiControl, 1: , % Row[ dex , 2 ] , % List1[ posi ].Artist
	GuiControl, 1: , % Row[ dex , 3 ] , % List1[ posi ].Year
}

class GuiDesigner	{

	AddTrigger( Gui_Name := 1 , x := 0 , y := 0 , w := 100 , h := 100 , Label := "" , Index := "" ){
		Gui, % Gui_Name ": Add" , Text , % "x" X " y" Y " w" W " h" H " hwndhwnd "
		fn := Func(Label).Bind(hwnd)
		GuiControl, % Gui_Name ":+G" , % hwnd , % fn
		return hwnd
	}
	
	AddText( Gui_Name := 1 , x := 0 , y := 0 , w := 100 , h := 100 , Text := "" , center := 1){
		Gui, % Gui_Name ": Add" , Text , % ( ( center ) ? ( "Center " ) : ("") ) "x" X " y" Y " w" W " h" H " BackgroundTrans 0x200 hwndhwnd", % Text
		return hwnd
	}
	
	Fill_Rectangle( Gui_Name := 1 , x := 0 , y := 0 , w := 100 , h := 100 , Color := "Black" , Color2 := "Black" , filllevel := 0 ){
		Gui, % Gui_Name ": Add" , Progress , % "x" X " y" Y " w" W " h" H " Background" Color " c" Color2 " hwndhwnd" ,%  filllevel
		return hwnd
	}
	
	Draw_Outline( Gui_Name , x , y , w , h , Color := "Black" , thickness := 1 ){
		Gui, % Gui_Name ": Add" , Progress , % "x" X " y" Y " w" W " h" thickness " Background" Color 
		Gui, % Gui_Name ": Add" , Progress , % "x" X " y" Y " w" thickness " h" H " Background" Color
		Gui, % Gui_Name ": Add" , Progress , % "x" X " y" Y + H - thickness " w" W " h" thickness " Background" Color
		Gui, % Gui_Name ": Add" , Progress , % "x" X + W - thickness " y" Y " w" thickness " h" H " Background" Color
	}
}
20191204014452.png
20191204014452.png (31.18 KiB) Viewed 2443 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mikeyww, WAZAAAAA and 403 guests