Blinko Posted March 30, 2007 Posted March 30, 2007 Why are the icons different for the two GUI controls. Thanks for your help. #include <GUIConstants.au3> $iconfile="C:\WINDOWS\system32\SHELL32.dll" $iconnum=220 $Form1 = GUICreate("AForm1", 183, 224, 533, 411) $Label1 = GUICtrlCreateLabel("Button GUI icon",10,24,100,20) $Button1 = GUICtrlCreateButton("", 152, 24, 20, 20, $BS_ICON) GUICtrlSetImage (-1,$iconfile,$iconnum,0) $Label1 = GUICtrlCreateLabel("Icon GUI",10,50,100,20) $ICON1 = GUICtrlCreateIcon($iconfile, $iconnum, 152, 50, 20, 20, BitOR($SS_NOTIFY,$WS_GROUP)) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
martin Posted March 30, 2007 Posted March 30, 2007 There is a difference of 1 in the icon numbers that are used depending on whether the control updated by GuiCtrlSetData is a button or an image by the looks of it. I don't know why but the code below illustrates the problem. expandcollapse popup#include <GUIConstants.au3> $iconfile="D:\WINDOWS\system32\SHELL32.dll" $iconnum=2 $Form1 = GUICreate("AForm1", 183, 224, 533, 411) $Label1 = GUICtrlCreateLabel("Button GUI icon",10,24,100,20) $Label1 = GUICtrlCreateLabel("Icon GUI",10,50,100,20) $ICON1 = GUICtrlCreateIcon($iconfile, $iconnum , 152, 50, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP)); $Button1 = GUICtrlCreateButton("", 152, 24, 32,32, $BS_ICON) GUISetState(@SW_SHOW) $n = $iconnum-1 $startt = timerinit() While 1 if TimerDiff($startt) >= 500 Then $startt = timerinit() $n += 1 GUICtrlSetData($Label1,$n) GUICtrlSetImage ($button1,$iconfile,$n-1,0);<------why -1? I don't know, maybe it's a bug. Guictrlsetimage($ICON1,$iconfile,$n,0); sleep(2) EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0,'number is',$n) EndSwitch WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
GaryFrost Posted March 31, 2007 Posted March 31, 2007 http://www.autoitscript.com/forum/index.ph...st&p=317442 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
martin Posted March 31, 2007 Posted March 31, 2007 (edited) History, raddishes and Autoit forums! Edited March 31, 2007 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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