taotao878 Posted March 3, 2008 Share Posted March 3, 2008 (edited) How to create the button like the Attachment ? Thanks! Edited March 5, 2008 by taotao878 Link to comment Share on other sites More sharing options...
GEOSoft Posted March 3, 2008 Share Posted March 3, 2008 See GuiToolbar Management and GuiButton Management in the User Defined Functions section of the help file. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
martin Posted March 3, 2008 Share Posted March 3, 2008 How to create the button like the Attachment ? Thanks!Here's a simple example of one way. expandcollapse popup#include <GUIConstants.au3> $GUI = GUICreate("My GUI") $ic = GUICtrlCreateIcon("shell32.dll",22,6,6,32,32) GUICtrlSetState(-1, $GUI_DISABLE) $b = GUICtrlCreateButton("File", 2, 2, 40, 40,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",22) GUICtrlSetState(-1,$GUI_HIDE) ;GUICtrlSetState(-1, $GUI_DISABLE) GUISetState() While 1 $m = GUIGetMsg() If $m = -3 then Exit $c = GUIGetCursorInfo($GUI) If $c[4] = $ic Then GUICtrlSetState( $b, $GUI_SHOW) GUICtrlSetState( $ic, $GUI_HIDE) $c = GUIGetCursorInfo($GUI) While $c[4] = $b If GUIGetMsg() = $b Then Do_Function() $c = GUIGetCursorInfo($GUI) WEnd GUICtrlSetState( $b, $GUI_HIDE) GUICtrlSetState( $ic, $GUI_SHOW) EndIf WEnd Func Do_Function() MsgBox(0x0, "test", "OK..... ", 3) EndFunc 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. Link to comment Share on other sites More sharing options...
taotao878 Posted March 4, 2008 Author Share Posted March 4, 2008 Thanks ! But the button only have ICON, dont't have text. Link to comment Share on other sites More sharing options...
martin Posted March 4, 2008 Share Posted March 4, 2008 Thanks !But the button only have ICON, dont't have text.True. You can add text like this. 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. Link to comment Share on other sites More sharing options...
GEOSoft Posted March 4, 2008 Share Posted March 4, 2008 As I pointed out earlier, the functions in GuiButton Management will create exactly what you have shown. If you are running the latest Beta then here is the sample code. See Button 6 expandcollapse popup#include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Opt("MustDeclareVars", 1) _Main() Func _Main() Local $hImage, $y = 70, $iIcon = 125, $btn[6], $rdo[6], $chk[6], $hImageSmall GUICreate("Buttons", 510, 400) GUISetState() $hImage = _GUIImageList_Create(32, 32, 5, 3, 6) For $x = 6 To 11 _GUIImageList_AddIcon($hImage, "shell32.dll", $x, True) Next $hImageSmall = _GUIImageList_Create(16, 16, 5, 3, 6) For $x = 6 To 11 _GUIImageList_AddIcon($hImageSmall, "shell32.dll", $x) Next $btn[0] = GUICtrlCreateButton("Button1", 10, 10, 90, 50) _GUICtrlButton_SetImageList($btn[0], $hImage) $rdo[0] = GUICtrlCreateRadio("Radio Button1", 120, 10, 120, 25) _GUICtrlButton_SetImageList($rdo[0], $hImageSmall) $chk[0] = GUICtrlCreateCheckbox("Check Button1", 260, 10, 120, 25) _GUICtrlButton_SetImageList($chk[0], $hImageSmall) For $x = 1 To 5 $btn[$x] = GUICtrlCreateButton("Button" & $x + 1, 10, $y, 90, 50) _GUICtrlButton_SetImageList($btn[$x], _GetImageListHandle("shell32.dll", $iIcon + $x, True), $x) $rdo[$x] = GUICtrlCreateRadio("Radio Button" & $x + 1, 120, $y, 120, 25) _GUICtrlButton_SetImageList($rdo[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x) $chk[$x] = GUICtrlCreateCheckbox("Check Button" & $x + 1, 260, $y, 120, 25) _GUICtrlButton_SetImageList($chk[$x], _GetImageListHandle("shell32.dll", $iIcon + $x), $x) $y += 60 Next While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Exit EndFunc ;==>_Main ; using image list to set 1 image and have text on button Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False) Local $iSize = 16 If $fLarge Then $iSize = 32 Local $hImage = _GUIImageList_Create($iSize, $iSize, 5, 3) If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then _GUIImageList_AddBitmap($hImage, $sFile) Else _GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge) EndIf Return $hImage EndFunc ;==>_GetImageListHandle George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
martin Posted March 4, 2008 Share Posted March 4, 2008 As I pointed out earlier, the functions in GuiButton Management will create exactly what you have shown.If you are running the latest Beta then here is the sample code. See Button 6Thanks for showing that George. Even though I should get used to it, it amazes me how I miss knowing about some of these things. I have often wanted just what your example shows but didn't know how to do it in AutoIt; I obviously didn't look hard enough. 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. Link to comment Share on other sites More sharing options...
GaryFrost Posted March 4, 2008 Share Posted March 4, 2008 Looks more like a toolbar button, from the help: expandcollapse popup#include <GuiToolbar.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) $Debug_TB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hGUI, $hToolbar, $aStrings[4] Local Enum $idNew = 1000, $idOpen, $idSave, $idHelp ; Create GUI $hGUI = GUICreate("Toolbar", 400, 300) $hToolbar = _GUICtrlToolbar_Create ($hGUI) GUISetState() ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add strings $aStrings[0] = _GUICtrlToolbar_AddString ($hToolbar, "&New") $aStrings[1] = _GUICtrlToolbar_AddString ($hToolbar, "&Open") $aStrings[2] = _GUICtrlToolbar_AddString ($hToolbar, "&Save") $aStrings[3] = _GUICtrlToolbar_AddString ($hToolbar, "&Help") ; Add buttons _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW, $aStrings[0]) _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN, $aStrings[1]) _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE, $aStrings[2]) _GUICtrlToolbar_AddButtonSep ($hToolbar) _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP, $aStrings[3]) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GEOSoft Posted March 5, 2008 Share Posted March 5, 2008 Looks more like a toolbar button, from the help:That's what I was thinking when I made my first reply but then I got to thinking that maybe all he really wanted was a button with the image on the left followed by the text.signedClueless George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
taotao878 Posted March 5, 2008 Author Share Posted March 5, 2008 (edited) Sorry, Perhaps I did not say clearly This is a button, and not a toolbar please look the Attachment. Thanks Edited March 5, 2008 by taotao878 Link to comment Share on other sites More sharing options...
GaryFrost Posted March 5, 2008 Share Posted March 5, 2008 Sorry, Perhaps I did not say clearlyThis is a button, and not a toolbar please look the Attachment.ThanksPost #6 by GEOSoft is what you want then SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
zaini Posted September 23, 2008 Share Posted September 23, 2008 its good geosoft...thanx Link to comment Share on other sites More sharing options...
GEOSoft Posted September 26, 2008 Share Posted September 26, 2008 its good geosoft...thanxGlad you like it but I didn't write it. That was written by Gary and it's in the standard UDFs. I just showed the OP how to use it. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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