*deleted*
[Function] _CreateImageButton_ (Colored buttons with GDI)
Started by
nick
, Dec 11 2008 08:22 PM
19 replies to this topic
Many thanks for this great function.
#2
-
Posted 11 December 2008 - 08:56 PM
Nice!
#3
-
Posted 11 December 2008 - 09:05 PM
This could be really helpful for creating more interesting guis easily. Thanks
#5
-
Posted 12 December 2008 - 05:14 AM
aboutscript ⋰ apps ⋱ scripts
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Request Video Tutorials Here or View Current Tutorials on YouTube
Any code ⇈ above ⇈ requires AutoHotkey_L to run
Can the 1-line text restriction be removed? because the original display in buttons is useful, esp, the vertically centered, which exists only in Button but not other controls?
#6
-
Posted 19 February 2009 - 10:16 PM
Hi, I was trying this function and it works alright, however when I disable a button it nukes the image. I'm not very good at deciphering code that is not mine >< Can anyone help me out? I'd like the button and/or the text to change colors when disabled, I don't mind calling the function extra times to redraw the button as long it draws properly on a disabled button.
#9
-
Posted 18 March 2009 - 10:44 PM
... two workarounds:
#NoEnv #Include _CreateImageButton_.ahk FS := 14 BMIX := 0 Disabled := False Gui, Margin, 20, 20 Gui, Color, 608080 Gui, Font, s%FS% Gui, Add, Button, vButton1 gButton1 hwndBT1ID, Not really regular! BMIX++, hBM%BMIX% := _CreateImageButton_(BT1ID, "000000", "00FF00", 2, "E0E0E0") Gui, Add, Button, xp yp vButton2 hwndBT2ID, Not really regular! BMIX++, hBM%BMIX% := _CreateImageButton_(BT2ID, "000000", "008000", 2, "808080") GuiControl, Hide, Button2 Gui, Add, Button, vButton3 gButton3 hwndBT3ID, Not really regular! BMIX++, hBM%BMIX% := _CreateImageButton_(BT3ID, "000000", "00FF00", 2, "E0E0E0") Gui, Add, Text, xp yp wp hp vText1 cGreen BackGroundTrans Center 0x200 Hidden , Not really regular! Gui, Add, Button, xm wp hp vButton gButton, Disable Gui, Show, , Colored Buttons Return GuiClose: GuiEscape: Loop, %BMIX% { DllCall("DeleteObject", "UInt", hBM%A_Index%) } ExitApp Button1: Button3: Gui, +OwnDialogs MsgBox, Button is enabled! Return Button: Disabled ^= True GuiControl, Disabled%Disabled%, Button1 GuiControl, Disabled%Disabled%, Button3 GuiControl, % (Disabled ? "Show" : "Hide"), Button2 GuiControl, % (Disabled ? "Show" : "Hide"), Text1 GuiControl, , Button, % (Disabled ? "Enable" : "Disable") Return
#10
-
Posted 19 March 2009 - 12:31 PM
nick :wink:
You're right, v2.0 doesn't work in Win98SE.
I have my system skinned and some of the buttons in the example inherit the skin while the others won't even show up. For comparison, I attached the result of the first example script with v1.0 of the function.
v2.0 v1.0
I have my system skinned and some of the buttons in the example inherit the skin while the others won't even show up. For comparison, I attached the result of the first example script with v1.0 of the function.
v2.0 v1.0
#12
-
Posted 29 March 2009 - 12:56 PM
(AHK 1.0.48.05 and Win98SE) forever | My scripts are here
awesome function - its exactly what i was as looking for ..
one issue (or something im overlooking) when calling the function to redraw an already function created button, it clears the text ...
my script makes lots of button color updates (i was previously just enabling/disabling a blank colored picture behind the button as to simulate a colored border)
is it just me (or maybe vista) ?
or should i be clearing anything prior to calling the func?
ive tried using DllCall("DeleteObject", "UInt", BTID) with no results
again great func - many thanks
---
UPDATE: I found the problem --
DllCall("GetWindowText", "UInt", HWND, "Str", TX, "Int", 255) can't retrieve the text of the control after its been created with the func
my hacky workaround was to just add a TX="" parameter to supply a text label when needed
hope this helps
one issue (or something im overlooking) when calling the function to redraw an already function created button, it clears the text ...
my script makes lots of button color updates (i was previously just enabling/disabling a blank colored picture behind the button as to simulate a colored border)
is it just me (or maybe vista) ?
or should i be clearing anything prior to calling the func?
ive tried using DllCall("DeleteObject", "UInt", BTID) with no results
again great func - many thanks
---
UPDATE: I found the problem --
DllCall("GetWindowText", "UInt", HWND, "Str", TX, "Int", 255) can't retrieve the text of the control after its been created with the func
my hacky workaround was to just add a TX="" parameter to supply a text label when needed
hope this helps
#13
-
Posted 09 April 2009 - 11:25 PM
Bugfix on 2009-08-25 (http://de.autohotkey...p?p=43871#43871)
#14
-
Posted 25 August 2009 - 05:19 AM
nick :wink:
Awesome function. Ty.
One wish - Add option to specify bitmap file directly or pass bitmap handle.
One wish - Add option to specify bitmap file directly or pass bitmap handle.
#15
-
Posted 27 October 2009 - 08:45 AM