wraithdu Posted February 25, 2010 Share Posted February 25, 2010 (edited) I've been working on this one for a while now, tweaking here and there. A special thanks to Melba23 for his help in testing and suggestions.This UDF creates two-state toggle buttons: click once to depress the button, click again to release it. They keyboard Space and Enter keys can also toggle the buttons. An optional user function is called on each state change and passed a parameter that can be used with the included functions to get information about the button that was clicked.There are two versions of this UDF included in the archive with associated examples. One 'normal' UDF and a second written with AutoItObject (a big congrats to the AIO team!). Both are well documented and the examples are easy to follow.Technical Note and Warning:Most people who use this UDF can safely ignore the following. Under certain circumstances AutoIt can deadlock when calling a callback from within a callback (for example using SendMessage to send a subclassed button a message from within a mouse hook). I've experienced odd and inconsistent behavior in this regard. As it stands, both versions of the UDF work perfectly. However care should be taken when using these UDFs with other AutoIt callbacks in your scripts. This is especially true with the AutoItObject version since all AIO methods are implemented as callbacks.ToggleButton.zip Edited February 25, 2010 by wraithdu Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2010 Moderators Share Posted February 25, 2010 wraithdu, Pleased to see that you did decide to release. Nice to have a toggle other than the classic checkbox/radio. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
playlet Posted February 25, 2010 Share Posted February 25, 2010 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
funkey Posted February 25, 2010 Share Posted February 25, 2010 Nice script! But what is wrong with the default toggle button? Global $gui = GUICreate("Test", 155, 155) For $i = 0 To 15 GUICtrlCreateCheckbox($i + 1, 10 + (35 * Mod($i, 4)), 10 + (35 * Floor($i / 4)), 30, 30, 0x1000) ;$BS_PUSHLIKE Next GUISetState() Do Until GUIGetMsg() = -3 Acanis 1 Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
wraithdu Posted February 26, 2010 Author Share Posted February 26, 2010 ... I'm gonna go shoot myself now. Acanis and GoogleGonnaSaveUs 2 Link to comment Share on other sites More sharing options...
corgano Posted February 26, 2010 Share Posted February 26, 2010 LOL Couldn't get the udf to work. I got this: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Jon\Desktop\New folder\ToggleButton\button_ex3.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>19:16:28 Starting AutoIt3Wrapper v.2.0.1.22 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/ CPU:X64 OS:X86) >Running AU3Check (1.54.14.0) params:-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 from:C:\Program Files\AutoIt3 C:\Users\Jon\Desktop\New folder\ToggleButton\ToggleButton.au3(336,42) : ERROR: OnAutoItExitRegister(): undefined function. OnAutoItExitRegister("_ToggleButtonExit") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\Jon\Desktop\New folder\ToggleButton\button_ex3.au3 - 1 error(s), 0 warning(s) !>19:16:28 AU3Check ended.rc:2 >Exit code: 0 Time: 1.734 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
wraithdu Posted February 26, 2010 Author Share Posted February 26, 2010 (edited) Get with the times! The UDF requires the newest release of AutoIt with the OnAutoItExitRegister function (not that it even matters anymore...). Edited February 26, 2010 by wraithdu Link to comment Share on other sites More sharing options...
Yoriz Posted February 26, 2010 Share Posted February 26, 2010 (edited) corgano you should update your version of autoit, the error you have ERROR: OnAutoItExitRegister(): undefined function. is because 15th January, 2010 - v3.3.4.0 OnAutoItExit() has been removed. See the new functions OnAutoItExitRegister() and OnAutoItExitUnregister(). well done wraithdu, its good to see another exapmle of AutoItObject in action Edited February 26, 2010 by Yoriz GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
MilesAhead Posted March 3, 2010 Share Posted March 3, 2010 If I copyright this:OnAutoItExitRegister("OnAutoItExit")can I please get $1 royalty every time somebody uses it? My Freeware Page 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