TheDcoder Posted December 10, 2015 Share Posted December 10, 2015 (edited) Hello ,#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 259, 91, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 88, 32, 75, 25) GUICtrlSetImage($Button1, @ScriptDir & '\grass_arrow.ico') GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### AdlibRegister("DisableAndEnable", 4000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func DisableAndEnable() GUICtrlSetState($Button1, $GUI_DISABLE) Sleep(2000) GUICtrlSetState($Button1, $GUI_ENABLE) EndFuncDid you see the icon getting messed up? Does anybody here know how to avoid it? Thanks in Advance, TD grass_arrow.ico Edited December 12, 2015 by TheDcoder Added Screenshot EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
BrewManNH Posted December 10, 2015 Share Posted December 10, 2015 No idea what exactly you're asking here. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 10, 2015 Moderators Share Posted December 10, 2015 @TheDcoder you have been around long enough to know better than to make such a post. If you're having a problem, explain in detail what you're trying to do, and share the code, rather than giving some lame vague issue and expecting people to play 20 questions with you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
TheDcoder Posted December 11, 2015 Author Share Posted December 11, 2015 I added the code EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheDcoder Posted December 11, 2015 Author Share Posted December 11, 2015 I wonder if it has anything to do with the colored button bug? EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
BrewManNH Posted December 11, 2015 Share Posted December 11, 2015 Could you post the ICO file as well? Also, I doubt this has anything to do with button coloring as you're not coloring the button. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
TheDcoder Posted December 11, 2015 Author Share Posted December 11, 2015 @BrewManNH Ooops, I deleted the download link while adding the code EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Zedna Posted December 11, 2015 Share Posted December 11, 2015 (edited) Post screenshots.On my Win7 with Classic theme and Aero disabled it looks OK. Edited December 11, 2015 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
TheDcoder Posted December 12, 2015 Author Share Posted December 12, 2015 @Zedna The icon looks messed up in the 2nd screenshot, I guess Aero is enabled in that screenshot?Added a GIF on main post, TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 12, 2015 Moderators Share Posted December 12, 2015 @TheDcoder can you elaborate on "looks messed up"? On my screen, other than being grayed out, Zedna's icon looks fine. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted December 13, 2015 Share Posted December 13, 2015 (edited) Really? Nobody see the disappearing pixels?@TheDcoderThe pixels with alpha in them goes fully transparent when the button is disabled. I don't know why so I can't suggest a fix other than removing them. Like so:grass_arrow2.icoOr create your own custom button... Edited December 13, 2015 by AdmiralAlkex TheDcoder and Xandy 2 .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
TheDcoder Posted December 13, 2015 Author Share Posted December 13, 2015 Really? Nobody see the disappearing pixels?Glad you spotted it ... I will do some research and report back with a solution (if exists ) Thanks! TD AdmiralAlkex 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
TheDcoder Posted December 13, 2015 Author Share Posted December 13, 2015 (edited) @AdmiralAlkex I searched around a little and your solution seems to be the best... How did you remove them anyway? Just tried a online png to ico converter and it worked! Edited December 13, 2015 by TheDcoder EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
LarsJ Posted December 13, 2015 Share Posted December 13, 2015 Have you tried the second proposal by AdmiralAlkex? Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
TheDcoder Posted December 13, 2015 Author Share Posted December 13, 2015 @LarsJ Too much pain for to make a button UDF EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
LarsJ Posted December 13, 2015 Share Posted December 13, 2015 It's much easier than you think. This is the example for _GUICtrlButton_Create in the help file. One line modified. Two lines added:expandcollapse popup#include <GuiButton.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $g_idBtn, $g_idRdo, $g_idChk, $g_idMemo ; Note the controlID from these buttons can NOT be read with GUICtrlRead Example() Func Example() Local $hGUI $hGUI = GUICreate("Buttons", 400, 400) $g_idMemo = GUICtrlCreateEdit("", 119, 10, 276, 374, $WS_VSCROLL) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New") $g_idBtn = _GUICtrlButton_Create($hGUI, "Button1", 10, 10, 90, 50, $BS_ICON) ; <<<< Added $BS_ICON style _GUICtrlButton_SetImage( $g_idBtn, "grass_arrow.ico" ) ; <<<< Added _GUICtrlButton_Enable( $g_idBtn, False ) ; <<<< Added $g_idRdo = _GUICtrlButton_Create($hGUI, "Radio1", 10, 60, 90, 50, $BS_AUTORADIOBUTTON) $g_idChk = _GUICtrlButton_Create($hGUI, "Check1", 10, 120, 90, 50, $BS_AUTO3STATE) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) MemoWrite("$g_idBtn handle: " & $g_idBtn) MemoWrite("$g_idRdo handle: " & $g_idRdo) MemoWrite("$g_idChk handle: " & $g_idChk & @CRLF) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>Example ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local Const $BCN_HOTITEMCHANGE = -1249 Local $tNMBHOTITEM = DllStructCreate("hwnd hWndFrom;int IDFrom;int Code;dword dwFlags", $lParam) Local $nNotifyCode = DllStructGetData($tNMBHOTITEM, "Code") Local $nID = DllStructGetData($tNMBHOTITEM, "IDFrom") Local $hCtrl = DllStructGetData($tNMBHOTITEM, "hWndFrom") Local $iFlags = DllStructGetData($tNMBHOTITEM, "dwFlags") Local $sText = "" Switch $nNotifyCode Case $BCN_HOTITEMCHANGE ; Win XP and Above If BitAND($iFlags, 0x10) = 0x10 Then $sText = "$BCN_HOTITEMCHANGE - Entering: " & @CRLF ElseIf BitAND($iFlags, 0x20) = 0x20 Then $sText = "$BCN_HOTITEMCHANGE - Leaving: " & @CRLF EndIf MemoWrite($sText & _ "-----------------------------" & @CRLF & _ "WM_NOTIFY - Infos:" & @CRLF & _ "-----------------------------" & @CRLF & _ "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _ "CtrlID" & @TAB & ":" & $nID & @CRLF & _ "CtrlHWnd:" & $hCtrl & @CRLF & _ _GUICtrlButton_GetText($hCtrl) & @CRLF) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ; React on a button click Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $nNotifyCode = BitShift($wParam, 16) Local $nID = BitAND($wParam, 0x0000FFFF) Local $hCtrl = $lParam Local $sText = "" Switch $hCtrl Case $g_idBtn, $g_idRdo, $g_idChk Switch $nNotifyCode Case $BN_CLICKED $sText = "$BN_CLICKED" & @CRLF Case $BN_PAINT $sText = "$BN_PAINT" & @CRLF Case $BN_PUSHED, $BN_HILITE $sText = "$BN_PUSHED, $BN_HILITE" & @CRLF Case $BN_UNPUSHED, $BN_UNHILITE $sText = "$BN_UNPUSHED" & @CRLF Case $BN_DISABLE $sText = "$BN_DISABLE" & @CRLF Case $BN_DBLCLK, $BN_DOUBLECLICKED $sText = "$BN_DBLCLK, $BN_DOUBLECLICKED" & @CRLF Case $BN_SETFOCUS $sText = "$BN_SETFOCUS" & @CRLF Case $BN_KILLFOCUS $sText = "$BN_KILLFOCUS" & @CRLF EndSwitch MemoWrite($sText & _ "-----------------------------" & @CRLF & _ "WM_COMMAND - Infos:" & @CRLF & _ "-----------------------------" & @CRLF & _ "Code" & @TAB & ":" & $nNotifyCode & @CRLF & _ "CtrlID" & @TAB & ":" & $nID & @CRLF & _ "CtrlHWnd:" & $hCtrl & @CRLF & _ _GUICtrlButton_GetText($hCtrl) & @CRLF) Return 0 ; Only workout clicking on the button EndSwitch ; Proceed the default AutoIt3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default AutoIt3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
TheDcoder Posted December 13, 2015 Author Share Posted December 13, 2015 @LarsJ , Looks complicated... I still think @AdmiralAlkex's 1st solution is better for me... I want average users to understand my code EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
LarsJ Posted December 13, 2015 Share Posted December 13, 2015 That's fine. How does the disabled icon look? Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
TheDcoder Posted December 13, 2015 Author Share Posted December 13, 2015 @LarsJ Just tested it... The result might hurt a little:TD EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion Link to comment Share on other sites More sharing options...
LarsJ Posted December 13, 2015 Share Posted December 13, 2015 I can't see your pictures but i'll guess that it doesn't look good. When I tested, it looked like the picture posted by Zedna. Since the icons looks bad in both examples (your example in first post and my example), I don't think we can blaime internal AutoIt code for the problem. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now