Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Small toolbar with icon-buttons.


  • Please log in to reply
12 replies to this topic
toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
This is a script I did when I started with AHK. So please forgive me if the script isn't nicely structured or commented. But since a lot of people asked for icon as buttons, I thought I post this, so maybe someone likes the approach and uses it.

This script was a try to convince Rajat to extend his SmartGui to a more elaborated IDE. Therefore I called it SGUIv4.

Here is the script and the icons/pictures:
https://ahknet.autoh..._v4/SGUI_v4.zip

The GUIs do not have much functions, but the icons on the "move" and the "add control" guis (gui 3 and 4 on the left side of the following image) give feedback when the user clicks on them. They get a border (a line around them). These buttons are actually picture controls.
On the "move" gui the icons only show the border for a short period of time.
On the "add control" gui only one icons at a time has the the border and keeps it until another icon in that gui gets selected.
I have created all icons/pictures myself, but of cause I have made them as close as possible to the well known one.

This is how it looks like: And if you want to know how they behave or how it is done, have a look at the script.
Posted Image
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
as i said earlier, its very good looking toralf!
but the problem is that when i released SGUI 1.0, ahk's GUI was in its first alpha... my options were very limited and creating a creator with those limitations was some task in itself. later with the updates to ahk, sgui kept building up on the earlier foundations. now to shift to something like this, i'll have to do a complete rewrite, which is kind of scary to think...

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
I know, and I fully understand your point. I don't wanted or will ever try to insult you. I do not try to convince you to do it any more. I think SmartGUI is perfect.

To my shame I have to admit, that I don't use it anymore. I have a different way to script, so I found a different way to create my guis.

I only posted the script so people could see the possibilities in AHK.
I just create a full program suite to automate a process, with about 4000 lines of code, 8 GUIs (2 of them very complex). The possibilities with AHK are endless.

Sorry again Rajat, this wasn't meant to be against you.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004

Sorry again Rajat, this wasn't meant to be against you.

u got me all wrong here buddy... i wasn't annoyed or anything! i just wanted to say that for applying this improved gui to sgui i'll need to almost write it again. please don't take it otherwise.

and by the way if u don't mind disclosing, i'm curious how do u create your guis.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


  • Guests
  • Last active:
  • Joined: --
I just write it manually. :)

I always use relative positions for controls. If I would use SmartGUI I would have all the commands, but I would need to restructure them to get them into the right order, would have to delte the absolut coordinates and add the relative again. That process takes longer then the direct manual approach (with sometimes copy and paste). Plus I can right away give certain options to the control. Since I realized that a lot of my code is similar in different scripts I always wanted (but never done yet) to use your SnippetLibrary to ease and speed it up further.

Just my personal workflow.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
It looks great. There is a plan to add a Toolbar control someday soon, which will hopefully make things like this easier.

Thanks for posting your work.

Alan Martin
  • Members
  • 2 posts
  • Last active: Dec 16 2005 09:54 PM
  • Joined: 10 Jul 2005

It looks great. There is a plan to add a Toolbar control someday soon, which will hopefully make things like this easier.


As a newcomer, may I suggest: In the meantime, if it will be a while before you make the new Toolbar control, maybe you could add "toolbar" to Help's index, leading to a page with a few tips. It took me a while to realise that to make a toolbar you use the gui functions - at first I imagined AHK does not include making toolbars.

BTW This newb is already amazed at what AHK can do and its excellent Help :)

webber
  • Members
  • 129 posts
  • Last active: Aug 13 2011 06:45 PM
  • Joined: 25 Aug 2005
SGUIv4.

This should really be continued. It's definitely what is needed for AHK.

SmartGUI doesn't make sense and I've never been able to figure out how to make it work.
________
Silver Surfer Vaporizer

Nemroth
  • Members
  • 278 posts
  • Last active: Dec 31 2011 10:53 PM
  • Joined: 07 Sep 2004
It's a very beautifull work. Bravo !

Invalid User
  • Members
  • 447 posts
  • Last active: Mar 27 2012 01:04 PM
  • Joined: 14 Feb 2005
The only thing I fear from this great work is when I plan on making a full screen gui, that has no intent of being used on another pc, I just maximize the window and start popping in controls. If I am limited to the window I am working in, will that mean the window size(the window I can add controls to) can only be as large as the windows workspace?
my lame sig :)

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Dear webber, Nemroth and Invalid
Thanks for the comments, but I have only done these GUIs for demonstration. There is no code behind them.

You are free to fill the gaps. I do not work on it.

As for Invalids comment. I haven't though on this, since I never did full screen Guis. Since the GUIs do not allow scrollbars yet, maybe a context menu could help to hide the toolbars, e.g like SmartGui.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Invalid User
  • Members
  • 447 posts
  • Last active: Mar 27 2012 01:04 PM
  • Joined: 14 Feb 2005
Perhaps a workaround could be used, its really bulky and buggy, but its a workaround until scroll bars around.

StaCtrlsList = msctls_trackbar321,msctls_trackbar322,msctls_Progress321,msctls_Progress322,Edit1,Edit2,Edit3,Edit4

;Define Window 

WinX = 149

WinY = 118

WinH = 227

WinW = 506

WinTitle = InfiniView

;Define Mins and Maxes

XViewMax := WinW

XViewMin = 0

YViewMax := WinH

YViewMin = 0

Gui, Add, GroupBox, vCtrl1 x26 y27 w100 h30, one

Gui, Add, GroupBox, vCtrl2 x156 y57 w110 h70, two

Gui, Add, GroupBox, vCtrl3 x316 y67 w110 h70, three



Gui, Add, Slider, vXModVal Range-10-10 x46 y197 w360 h20, 0

Gui, Add, Progress, vXModDisp x6 y187 w440 h10, 25



Gui, Add, Slider, vYModVal Range-10-10 Vertical Invert x456 y27 w20 h140, 0

Gui, Add, Progress, vYModDisp Vertical x446 y7 w10 h180, 25 



Gui, Add, Edit, vXViewMin x6 y197 w40 h20, %XViewMin%

Gui, Add, Edit, vXViewMax x406 y197 w40 h20, %XViewMax%



Gui, Add, Edit, vYViewMin x456 y7 w40 h20, %YViewMin%

Gui, Add, Edit, vYViewMax x456 y167 w40 h20, %YViewMax%





Gui, Show, x%Winx% y%WinY% h%WinH% w%WinW%, %WinTitle%



SetTimer, MonitorMouse

SetTimer, MonitorSlider, 200

SetTimer, MonitorSlider, Off

Return





;-----Timers

MonitorMouse:

MouseGetPos, XPos, YPos, %WinTitle%, Ctrl

;MsgBox %Ctrl%

If Ctrl Contains msctls_trackbar32

{

	SetTimer, MonitorMouse, Off

	SetTimer, MonitorSlider, On

}

Return



MonitorSlider:

MouseGetPos, ,, %WinTitle%, Ctrl

If Ctrl Not Contains msctls_trackbar32

{

	SetTimer, MonitorSlider, Off

	SetTimer, MonitorMouse, On

	Return

}

StringRight, SModi, Ctrl, 1

If Smodi = 1

	SMod = X

If Smodi = 2

	SMod = Y

GetKeyState, Lbs, LButton, P

If Lbs = D

{

	Loop

	{

		GetKeyState, Lbs, LButton, P

		If Lbs = U	

		{

			Gui, Submit, Nohide

			StringLeft, PosNeg, %SMod%ModVal, 1

			I := %SMod%ModVal

			If PosNeg = -

			{

				StringTrimLeft, I, %SMod%ModVal, 1

				PosNeg = 1	

			}

			I := Sqrt(I)

			I2 = %I% 

			Loop, %I%

			{

				I2--

				Sleep, 50

				CVal := I2 * 2

				

				If PosNeg = 1 ;it is negative

					GuiControl,, %SMod%ModVal, +%Cval%

				Else

					GuiControl,, %SMod%ModVal, +-%Cval%

			}

			

			;GuiControl, , ChangeVal, 0

			Break

		}

		;Else ;Modify window view here

		{

			WinGet, CtrlList, ControlList, %WinTitle%

			Loop, Parse, CtrlList, `n

			{

				If A_LoopField Not In %StaCtrlsList%

				{

					;MsgBox %A_LoopField%

					ControlGetPos, X, Y,,, %A_LoopField%, %WinTitle%

					

					Nxpos := X + XModVal

					Nypos := Y + YModVal

					ControlMove, %A_LoopField%, %Nxpos%, %Nypos%,,, %WinTitle%



					

				}

			}

		}

	}

	GuiControl, , %SMod%ModVal, 0

}

Return



F10::ListVars

F9::Reload

GuiClose:

ExitApp

my lame sig :)

The Flo
  • Guests
  • Last active:
  • Joined: --
I think this is a really good example for windows as a super-plug-in for autohotkey... :D