[ Class + ( Editor Tool ) ] Custom Gui Image Button

Post your working scripts, libraries and tools for AHK v1.1 and older
keylo
Posts: 51
Joined: 21 Oct 2020, 21:03

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

09 Oct 2021, 06:05

Wow, that a wonderful tool, thank you He :bravo: llbent
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

17 Oct 2021, 03:17

keylo wrote:
09 Oct 2021, 06:05
Wow, that a wonderful tool, thank you He :bravo: llbent
Thank you keylo.
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

25 Oct 2021, 14:05

Dear Hellbent(CivReborn)

I love all your tutorials on GUIs and all the other ones for Autohotkey. I think you are a genius at best. Love the
collaboration with Joe Glines as I watch all these tutorials as well. and they are jam packed with invaluable information
for us wanting to take our computer experience to the next level.

I have downloaded almost all of your work and have learned so much, but I am writing this message just to ask you
for some help regarding this new editor you have made which looks incredible. (Dark green, HB logo in the middle)!!!1

I copied all of the code but when it runs, it runs in the taskbar and I don't see the editor. I don't get any errors
because I am using the GDIP library within the same script (towards the bottom of the file).

Should I keep these separate and use an include statement at the beginning instead?

Any help regarding use of the new editor will be greatly appreciated as this looks like an awesome tool.

Thanks for all of your help,
Dwight
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

25 Oct 2021, 17:23

To any of you who have the editor working:

I believe that the code in the Editor box is the same as the button class box, which leads me
to believe that this might be the reason why the code I copied and pasted (from the Editor's box "show" button)
is not working - because it is the same as the code from the Button Class in the beginning of this thread.

Anyone with the actual Editor code please post or show me what I need to do.

Thank you.
Dwight
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

25 Oct 2021, 17:59

To AutoHotKey Forum Staff:

I checked again and I see that the Editor's CODE is the same as the Button Class CODE.

For whatever reason, this was either changed by someone or the error was unintentional.

Please fix as this would probably solve many issues regarding other users wanting to use this
amazing tool,.

Thank you
Dwight
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

25 Oct 2021, 18:17

To all in the AutoHotKey forum:

re: Update to Button Class and Editor box "same code" issue.

I was able to navigate to Joe Glines' Automator website and on the introduction Joe
has provided links to the files he downloaded or copied as a zip file.

I was able to download the zip file and lo and behold, the Editor.ahk file was 113 thousand
bytes as opposed to the one that is on the Pastebin website which is far less in size simply
because it is the button class CODE NOT the Editor CODE.

Pastebin should fix this. But at least for those who might run into this same problem,
navigate over to Joe's Automator page:

https://www.the-automator.com/hellbent-button-theme-creator-class/

... and here you will see a link that says "tutorials here" which should allow you to download
the zip files with the proper CODE for the Editor.

I am now running the Editor with no problems whatsoever. This indeed is an awesome tool.

Thanks Hellbent for your awesomeness and love for Autohotkey, it certainly rubs off on
all of us. Genius, dude, Genius!

Shout out to Joe (my other AutoHotKey mentor) for being so thorough in what he does.
Certainly a top of the line professional in his field.

Dwight
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

25 Oct 2021, 18:22

dideautomate wrote:
25 Oct 2021, 17:59
To AutoHotKey Forum Staff:

I checked again and I see that the Editor's CODE is the same as the Button Class CODE.

For whatever reason, this was either changed by someone or the error was unintentional.

Please fix as this would probably solve many issues regarding other users wanting to use this
amazing tool,.

Thank you
Dwight
Hi dideautomate

The editor is a separate script to the button class and needs to be in it's own script to work correctly. The editor borrows some of the basic function of the button class in order for there to be a functioning example of the button. If you try to combine the editor and the button class in the same script you will get errors because they will have functions with the same names.

Keep the editor on its own. The button class can be used in another script though.
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

26 Oct 2021, 08:47

After further review, I found that the CODE provided by "jly" that changes the theme
of the Editor to "white" is indeed the CODE for the Editor (Button Maker v1.01).

The CODE underneath the screen capture of the Dark themed editor is still showing
the same CODE for the Button class (Gen 3 button class) and as a result does NOT work
to load the Editor.

Originally I had downloaded (copied and pasted) the CODE by itself (like the instructions
say to do) but since this is the same button class code (from the first CODE box) it does
not bring up the Editor, it is the button class CODE. (Gen 3).

I was able to get the original Editor CODE from Joe Gline's Automator website where he
provides all the files in a zip file. I immediately saw the difference in the file size of the
Editor as opposed to the button class confirming that Joe's files had the correct CODE for
the Editor.

Again, pastebin should find a way to rectify this for other users who will certainly be
left in the dark when they download this CODE and find that it does not work.

The link to Joe's website to download the zip file is:

https://www.the-automator.com/hellbent-button-theme-creator-class/

Towards the end of the first paragraph, there is a link called "tutorial here" -
where one can download the zip file with the correct Editor CODE mentioned above
and incorrect on the Pastebin page.

D
dideautomate
Posts: 6
Joined: 13 Feb 2019, 18:07

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

26 Oct 2021, 08:57

Dear Hellbent:

I totally agree with what you mentioned regarding the CODE and keeping the script by itself.

The CODE however, underneath the Editor screen shot when one clicks on the SHOW button still
comes up with the same Button Class CODE from the first CODE box and is NOT the CODE for the
Editor itself.

It seems that at one time, this might have been working and the original CODE you pasted was
there but for whatever reason, now it is showing a duplicate of the Button class CODE and not
the Editor CODE and as a result will not work to load the Button Maker v1.01.

Nonetheless, I was able to get these files from Joe's website and am running the tool with no
problem whatsoever.

Lastly, I cannot say enough about your tutorials and teaching regarding Autohotkey and your
series on GUIs.

Thank you for all your expertise and tutorials.
Dwight
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

26 Oct 2021, 19:01

@dideautomate Thank you. I must have changed the wrong thing the last time I did a edit.
The editor is back up again.
User avatar
PENchanter
Posts: 10
Joined: 06 Sep 2021, 16:13

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

24 Dec 2021, 20:09

Hellbent wrote:
23 Apr 2021, 18:58
;Old
Pen := Gdip_CreatePen( "0xFF004444" , 1 ) , Gdip_DrawRoundedRectangle( G , Pen , 173 , 5 , 80 , 20 , 5 ) , Gdip_DeletePen( Pen )
WHAAAT?! Why am I being designated as "Old" and recommended for "Delete"[ion]?!?! *shudders* Why me?!?!?! :shock: :lol:
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

02 Jan 2022, 17:29

I got a new computer a few weeks ago which now gives me the option to use other DPI Scaling values.
With that I am finally able to play around with DPIScale

I took the code that is at the very end of the first post

i.e.

Code: Select all

;***************************************************************************************************
#Include <My Altered Gdip Lib> ; <----------- GDIP LIB
#Include <Gen 3 Buttons> ; <---------- HButton class
;***************************************************************************************************
#SingleInstance, Force
Gdip_Startup()

Theme1 := HBCustomButton()
GuiButtonType1.SetSessionDefaults( Theme1.All , Theme1.Default , Theme1.Hover , Theme1.Pressed )

MyFirstButton := New HButton( { Owner: 1 , X: 10 , Y: 10 , W: 100 , H: 35 , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" } )

Gui, 1:Show

return
GuiClose: 
	ExitApp

TestFunction(){
	ToolTip, In the test function
	SoundBeep, 500
}

HBCustomButton(){
	local MyButtonDesign := {}
	MyButtonDesign.All := {}
	MyButtonDesign.Default := {}
	MyButtonDesign.Hover := {}
	MyButtonDesign.Pressed := {}
	;********************************
	;All
	MyButtonDesign.All.W := 200 , MyButtonDesign.All.H := 65 , MyButtonDesign.All.Text := " Button " , MyButtonDesign.All.BackgroundColor := "0xFF22262A"
	;********************************
	;Default
	MyButtonDesign.Default.W := 200 , MyButtonDesign.Default.H := 65 , MyButtonDesign.Default.Text := "Button" , MyButtonDesign.Default.Font := "Arial" , MyButtonDesign.Default.FontOptions := " Bold Center vCenter " , MyButtonDesign.Default.FontSize := "12" , MyButtonDesign.Default.H := "0x0002112F" , MyButtonDesign.Default.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Default.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Default.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Default.TextOffsetX := "0" , MyButtonDesign.Default.TextOffsetY := "0" , MyButtonDesign.Default.TextOffsetW := "0" , MyButtonDesign.Default.TextOffsetH := "0" , MyButtonDesign.Default.BackgroundColor := "0xFF22262A" , MyButtonDesign.Default.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Default.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Default.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Default.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Default.ButtonMainColor1 := "0xFF272C32" , MyButtonDesign.Default.ButtonMainColor2 := "0xFF272C32" , MyButtonDesign.Default.ButtonAddGlossy := "1" , MyButtonDesign.Default.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Default.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Default.GlossBottomColor := "33000000"
	;********************************
	;Hover
	MyButtonDesign.Hover.W := 200 , MyButtonDesign.Hover.H := 65 , MyButtonDesign.Hover.Text := "Button" , MyButtonDesign.Hover.Font := "Arial" , MyButtonDesign.Hover.FontOptions := " Bold Center vCenter " , MyButtonDesign.Hover.FontSize := "12" , MyButtonDesign.Hover.H := "0x0002112F" , MyButtonDesign.Hover.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Hover.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextOffsetX := "0" , MyButtonDesign.Hover.TextOffsetY := "0" , MyButtonDesign.Hover.TextOffsetW := "0" , MyButtonDesign.Hover.TextOffsetH := "0" , MyButtonDesign.Hover.BackgroundColor := "0xFF22262A" , MyButtonDesign.Hover.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Hover.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Hover.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Hover.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Hover.ButtonMainColor1 := "0xFF122BE6" , MyButtonDesign.Hover.ButtonMainColor2 := "0xFF0006EE" , MyButtonDesign.Hover.ButtonAddGlossy := "1" , MyButtonDesign.Hover.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Hover.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Hover.GlossBottomColor := "33000000"
	;********************************
	;Pressed
	MyButtonDesign.Pressed.W := 200 , MyButtonDesign.Pressed.H := 65 , MyButtonDesign.Pressed.Text := "Button" , MyButtonDesign.Pressed.Font := "Arial" , MyButtonDesign.Pressed.FontOptions := " Bold Center vCenter " , MyButtonDesign.Pressed.FontSize := "12" , MyButtonDesign.Pressed.H := "0x0002112F" , MyButtonDesign.Pressed.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Pressed.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Pressed.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Pressed.TextOffsetX := "0" , MyButtonDesign.Pressed.TextOffsetY := "0" , MyButtonDesign.Pressed.TextOffsetW := "0" , MyButtonDesign.Pressed.TextOffsetH := "0" , MyButtonDesign.Pressed.BackgroundColor := "0xFF22262A" , MyButtonDesign.Pressed.ButtonOuterBorderColor := "0xFF62666a" , MyButtonDesign.Pressed.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Pressed.ButtonInnerBorderColor1 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonInnerBorderColor2 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonMainColor1 := "0xFF12161a" , MyButtonDesign.Pressed.ButtonMainColor2 := "0xFF33383E" , MyButtonDesign.Pressed.ButtonAddGlossy := "0" , MyButtonDesign.Pressed.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Pressed.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Pressed.GlossBottomColor := "33000000"
	;********************************
	return MyButtonDesign
}
and edited it to use your screen dpi.
I also added in a few default gui controls to create a more functional example.

Tested at 100%, 150%, 200% and 300% DPI Scaling. ( not that it should matter, Tested on windows 10 )

Code: Select all

;***************************************************************************************************
#Include <My Altered Gdip Lib> ; <----------- GDIP LIB
#Include <Gen 3 Buttons> ; <---------- HButton class
;***************************************************************************************************
#SingleInstance, Force
Gdip_Startup()

;***************************************************
Theme1 := HBCustomButton()
GuiButtonType1.SetSessionDefaults( Theme1.All , Theme1.Default , Theme1.Hover , Theme1.Pressed )
;***************************************************

Gui, 1:+AlwaysOnTop 
Gui, 1:Font, s12 , Arial
Gui, 1:Margin, % m := 10 , 10

Gui, 1:Add, ListBox, xm ym w320 r10, Item 1||Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|

;***************************************************
Gui, 1:-DPIScale
Button1 := New HButton( { Owner: 1 , X: ( (A_ScreenDPI / 96 ) * m ) , Y: "+" ( (A_ScreenDPI / 96 ) * m ) , W: ( (A_ScreenDPI / 96 ) * 100 )  , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Button2 := New HButton( { Owner: 1 , X: "+" ( (A_ScreenDPI / 96 ) * m ) , Y: "p" , W: ( (A_ScreenDPI / 96 ) * 100 ) , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Button3 := New HButton( { Owner: 1 , X: "+" ( (A_ScreenDPI / 96 ) * m ) , Y: "p" , W: ( (A_ScreenDPI / 96 ) * 100 ) , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Gui, 1:+DPIScale
;***************************************************

Gui, 1:Add, Checkbox, xm y+10 , Checkbox
Gui, 1:Add, Button, x+10 yp , Button
Gui, 1:Add, DDL, xm w320 r10, Item 1||Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|

;***************************************************
Gui, 1:-DPIScale
Button4 := New HButton( { Owner: 1 , X: ( (A_ScreenDPI / 96 ) * m ) , Y: "+" ( (A_ScreenDPI / 96 ) * m ) , W: ( (A_ScreenDPI / 96 ) * 100 ) , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Button5 := New HButton( { Owner: 1 , X: "+" ( (A_ScreenDPI / 96 ) * m ) , Y: "p" , W: ( (A_ScreenDPI / 96 ) * 100 ) , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Button6 := New HButton( { Owner: 1 , X: "+" ( (A_ScreenDPI / 96 ) * m ) , Y: "p" , W: ( (A_ScreenDPI / 96 ) * 100 ) , H: ( (A_ScreenDPI / 96 ) * 35 ) , Text: "OK" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" , FontSize: ( 12 * ( A_ScreenDPI / 96 ) ) } )
Gui, 1:+DPIScale
;***************************************************

Gui, 1:Add, Checkbox, xm y+10 , Checkbox
Gui, 1:Add, Button, x+10 yp , Button
Gui, 1:Add, DDL, xm w320 r10, Item 1||Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|Item 1|

;***************************************************

Gui, 1:Show

return
GuiClose: 
	ExitApp

TestFunction(){
	ToolTip, In the test function
	SoundBeep, 500
}

HBCustomButton(){
	local MyButtonDesign := {}
	MyButtonDesign.All := {}
	MyButtonDesign.Default := {}
	MyButtonDesign.Hover := {}
	MyButtonDesign.Pressed := {}
	;********************************
	;All
	MyButtonDesign.All.W := 200 , MyButtonDesign.All.H := 65 , MyButtonDesign.All.Text := " Button " , MyButtonDesign.All.BackgroundColor := "0xFF22262A"
	;********************************
	;Default
	MyButtonDesign.Default.W := 200 , MyButtonDesign.Default.H := 65 , MyButtonDesign.Default.Text := "Button" , MyButtonDesign.Default.Font := "Arial" , MyButtonDesign.Default.FontOptions := " Bold Center vCenter " , MyButtonDesign.Default.FontSize := "12" , MyButtonDesign.Default.H := "0x0002112F" , MyButtonDesign.Default.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Default.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Default.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Default.TextOffsetX := "0" , MyButtonDesign.Default.TextOffsetY := "0" , MyButtonDesign.Default.TextOffsetW := "0" , MyButtonDesign.Default.TextOffsetH := "0" , MyButtonDesign.Default.BackgroundColor := "0xFF22262A" , MyButtonDesign.Default.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Default.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Default.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Default.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Default.ButtonMainColor1 := "0xFF272C32" , MyButtonDesign.Default.ButtonMainColor2 := "0xFF272C32" , MyButtonDesign.Default.ButtonAddGlossy := "1" , MyButtonDesign.Default.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Default.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Default.GlossBottomColor := "33000000"
	;********************************
	;Hover
	MyButtonDesign.Hover.W := 200 , MyButtonDesign.Hover.H := 65 , MyButtonDesign.Hover.Text := "Button" , MyButtonDesign.Hover.Font := "Arial" , MyButtonDesign.Hover.FontOptions := " Bold Center vCenter " , MyButtonDesign.Hover.FontSize := "12" , MyButtonDesign.Hover.H := "0x0002112F" , MyButtonDesign.Hover.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Hover.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Hover.TextOffsetX := "0" , MyButtonDesign.Hover.TextOffsetY := "0" , MyButtonDesign.Hover.TextOffsetW := "0" , MyButtonDesign.Hover.TextOffsetH := "0" , MyButtonDesign.Hover.BackgroundColor := "0xFF22262A" , MyButtonDesign.Hover.ButtonOuterBorderColor := "0xFF161B1F" , MyButtonDesign.Hover.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Hover.ButtonInnerBorderColor1 := "0xFF3F444A" , MyButtonDesign.Hover.ButtonInnerBorderColor2 := "0xFF24292D" , MyButtonDesign.Hover.ButtonMainColor1 := "0xFF122BE6" , MyButtonDesign.Hover.ButtonMainColor2 := "0xFF0006EE" , MyButtonDesign.Hover.ButtonAddGlossy := "1" , MyButtonDesign.Hover.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Hover.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Hover.GlossBottomColor := "33000000"
	;********************************
	;Pressed
	MyButtonDesign.Pressed.W := 200 , MyButtonDesign.Pressed.H := 65 , MyButtonDesign.Pressed.Text := "Button" , MyButtonDesign.Pressed.Font := "Arial" , MyButtonDesign.Pressed.FontOptions := " Bold Center vCenter " , MyButtonDesign.Pressed.FontSize := "12" , MyButtonDesign.Pressed.H := "0x0002112F" , MyButtonDesign.Pressed.TextBottomColor2 := "0x0002112F" , MyButtonDesign.Pressed.TextTopColor1 := "0xFFFFFFFF" , MyButtonDesign.Pressed.TextTopColor2 := "0xFFFFFFFF" , MyButtonDesign.Pressed.TextOffsetX := "0" , MyButtonDesign.Pressed.TextOffsetY := "0" , MyButtonDesign.Pressed.TextOffsetW := "0" , MyButtonDesign.Pressed.TextOffsetH := "0" , MyButtonDesign.Pressed.BackgroundColor := "0xFF22262A" , MyButtonDesign.Pressed.ButtonOuterBorderColor := "0xFF62666a" , MyButtonDesign.Pressed.ButtonCenterBorderColor := "0xFF262B2F" , MyButtonDesign.Pressed.ButtonInnerBorderColor1 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonInnerBorderColor2 := "0xFF151A20" , MyButtonDesign.Pressed.ButtonMainColor1 := "0xFF12161a" , MyButtonDesign.Pressed.ButtonMainColor2 := "0xFF33383E" , MyButtonDesign.Pressed.ButtonAddGlossy := "0" , MyButtonDesign.Pressed.GlossTopColor := "0x11FFFFFF" , MyButtonDesign.Pressed.GlossTopAccentColor := "05FFFFFF" , MyButtonDesign.Pressed.GlossBottomColor := "33000000"
	;********************************
	return MyButtonDesign
}
.

100% DPI

.
20220102145857.png
20220102145857.png (16.07 KiB) Viewed 2823 times
.



300% DPI

.
20220102172731.png
20220102172731.png (82.61 KiB) Viewed 2823 times
.


PENchanter wrote:
24 Dec 2021, 20:09
Hellbent wrote:
23 Apr 2021, 18:58
;Old
Pen := Gdip_CreatePen( "0xFF004444" , 1 ) , Gdip_DrawRoundedRectangle( G , Pen , 173 , 5 , 80 , 20 , 5 ) , Gdip_DeletePen( Pen )
WHAAAT?! Why am I being designated as "Old" and recommended for "Delete"[ion]?!?! *shudders* Why me?!?!?! :shock: :lol:

Look away. You aren't going to want to see what I did to your buddy "Brush". :twisted:
User avatar
PENchanter
Posts: 10
Joined: 06 Sep 2021, 16:13

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

04 Jan 2022, 18:52

/me mourns buddy "Brush"...
fiendhunter
Posts: 133
Joined: 24 Jul 2019, 15:27

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

14 Aug 2022, 16:14

@Hellbent
Hi, nice work I found it today and start using :)

There is a problem for me. when I use "varGUI := Gdip_Startup()", show a gui do the things, destroy the gui, do the things every think okey untill now. script turn back to reshow the gui, but it cause crush with no error.

I search some and found I need to use "Gdip_Shutdown(varGUI)" but before this, I need to "Dispose" all items. I cant find how to do that. Is it possible, "Disposeall" ?
Panaku
Posts: 14
Joined: 02 Apr 2022, 17:24

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

30 Aug 2022, 12:58

I didn't see a way to utilize the GUI Context Menu and your Custom GUI Image Buttons, so I took the liberty of creating one. This method seems to work just fine and was pretty easily to implement, but if there already exists a way to utilize the Context Menu please let me know.

In your class file, you need to edit this section of code and add in the section in bold:

Code: Select all

_CreateControl( Input ){
		
		local hwnd
		
		Gui , % Input.Owner ":Add" , Pic , % "x" Input.X " y" Input.Y " w" Input.W " h" Input.H " v" Input.V " hwndhwnd 0xE"  
		;                                                                                       ^-----------^ *Add this in
		return hwnd
		
	}
[/b]

After that, when you're calling/creating the buttons in your actual script you just need to make this adjustment:

Code: Select all

MyFirstButton := New HButton( { Owner: 1 , X: 10 , Y: 10 , W: 100 , H: 35 , V: "TestButton1" , Text: "Reload" , Label: "TestFunction" } , { BackgroundColor: "0xFFF0F0F0" } )
;                                                                          ^----------------^ *Add this in
This will allow it to have a Control name and can then be manipulated by anything that uses the A_GuiControl variable.
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

08 Sep 2022, 23:57

@Panaku

I'm not sure of your intent but I think I get what you are after.

When you create a new button it returns the handle to the control ( The Hwnd ).
With that you can use any of the normal GuiControl and GuiControlGet commands.

Compare:

Code: Select all

Gui, 1:Add , Text , hwndTextHwnd
GuiControl, 1: , % TextHwnd , Hello  ;<---- Using the handle

Gui, 1:Add, Text , vTextVar
GuiControl, 1: , TextVar , Hello  ;<---- Using the variable

You can also use mousegetpos instead of A_GuiControl like so

Code: Select all

MouseGetPos,,,, ctrl , 2 ;<---- get the handle ( hwnd ) of the control under the cursor.
rx65m
Posts: 19
Joined: 16 Mar 2018, 17:29

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

27 May 2023, 11:53

I wonder how can we do to make the buttons created by this amazing piece of software to remain pressed until we click on them again.
Probably it is there, but I haven't found nothing so far.
gregster
Posts: 8916
Joined: 30 Sep 2013, 06:48

Re: [ Class + ( Editor Tool ) ] Custom Gui Image Button

29 May 2023, 16:05

Maestr0 wrote:
29 May 2023, 13:29
I couldn't find it in the manual, but I did a Bing.com chat (so AI)...
I've not tested it, though.
[...]
Yes, you can make a button appear pressed in the GUI without pressing it. You can use the `GuiControl` command with the `+E` option to enable or disable a control. For example, if you have a button with the name `Button1`, you can use the following code to make it appear pressed:

Code: Select all

GuiControl,, Button1, +E
[...]
@Maestr0:
Sounds unlikely, imho. This looks - at least - incomplete. Yes, there are extended styles which can be added or removed by using the options +E and -E, but a code specifying the style number should follow:
https://www.autohotkey.com/docs/v1/lib/Gui.htm#Options wrote:(Unnamed ExStyle): Specify a plus or minus sign followed immediately by the letter E and a decimal or hexadecimal extended style number. For example, +E0x40000 would add the WS_EX_APPWINDOW style, which provides a taskbar button for a window that would otherwise lack one. For other extended styles not documented here (since they are rarely used), see Extended Window Styles | Microsoft Docs for a complete list.
But this quote is actually about GUI styles, not styles of specific GUI elements.

If you had tested it and confirmed that it works, it would be acceptable. But untested code like this goes against our current rule re AI-generated code: please compare https://www.autohotkey.com/forumrules/#inappropriate_content (4.).
Unfortunately, the AIs make stuff up too often or recommend incomplete solutions or suggest pure nonsense - with unjustified confidence nonetheless.

Please be careful with AI-generated code in the future, especially if you are unsure that it works. Also, you should be sure that the posted answer fits the question. Afaik, this topic is specifically about painting buttons with GDI+, and not standard control elements. This means that extended styles are probably not relevant at all for these buttons.
This class already seems to support pressed buttons - and rx65m just seems to look for a way to toggle between pressed and unpressed state easily.
That's why I decided to hide your AI-generated answer. Afaics, it is unrelated to topic and question - and there are general doubts that the code would work.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 109 guests