tonedeaf Posted February 4, 2006 Posted February 4, 2006 (edited) A preliminary UDF to create toolbar controls with AutoIt. This script example can add standard toolbar buttons defined in Comctl32.dll. Support for adding custom Bitmap/Icons not added yet.As I'm not too familiar with WIN32 Programming, any help/contribution for completing these features/adding new features will be highly appreciated. With everyone's contribution, it would be possible to have a feature rich toolbar in AutoIt soon. NOTE: I've removed the attachments as the toolbar functions are available with PaulIA's Auto3Lib. This library is well written and provides more features. Edited February 27, 2007 by tonedeaf
Valuater Posted February 4, 2006 Posted February 4, 2006 Looks nice... tonedeaf i cant help here, but keep up the good work! 8)
rakudave Posted February 4, 2006 Posted February 4, 2006 nice worx, and very useful too! keep it up! Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table
Valuater Posted February 5, 2006 Posted February 5, 2006 maybe you can take a look at thishttp://www.autoitscript.com/forum/index.php?showtopic=20798#and thishttp://www.autoitscript.com/forum/index.php?showtopic=20967#hope that helpsyou all should get together8)
GaryFrost Posted February 5, 2006 Posted February 5, 2006 maybe you can take a look at thishttp://www.autoitscript.com/forum/index.php?showtopic=20798#and thishttp://www.autoitscript.com/forum/index.php?showtopic=20967#hope that helpsyou all should get together8) Those are menus, which have been pretty much worked out, although no standard udfs as of yetToolbars are whole different thing.Just wondering why using CreateWindowEx instead of CreateToolbarExHaven't had time to try it with CreateToolbarEx but after adding an event handler with this one, once the buttons are pressed they stay down, except the 1st one.Add a button to the form after creating the toolbar and the toolbar's 1st button won't be the default anymore. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
tonedeaf Posted February 5, 2006 Author Posted February 5, 2006 It looks like the toolbar buttons are not generating any messages when they are clicked. The only messages which are getting generated are $GUI_EVENT_PRIMARYDOWN (-7), $GUI_EVENT_PRIMARYUP (-8), and lot of Unknown (0) messages. As per microsoft: Each button in toolbar generates a standard command message which is sent back to the toolbar's parent. This standard command message is specified in the idCommand member of TBBUTTON Structure when the button is created. The point is, that you can fill in any numeric value as idCommand when creating the toolbar button and when the button is clicked, the same value will be raised as a message. That is why, we usually assign the same values to menu items and toolbar buttons which perform the same task. For eg. if I have a menu item Edit->Cut and I also have a toolbar button for Cut, I can assign a same idCommand value to both of them so that when anyone of them is clicked, the same function is called. Now, AutoIt automatically assigns a idCommand to Menu items and looks like that behaviour cannot be overridden. I checked the messages generated by the menu items and they look like to be in some sort of sequential numbering. And I am not able to do this for toolbar buttons. Even if I assign a random idCommand value to TBButton structure when creating a toolbar button, that value is not getting raised when the button is clicked. Is this a limitation of AutoIt? or can it be done through some other method? I hope that advanced members can through some light on this issue.
GaryFrost Posted February 5, 2006 Posted February 5, 2006 (edited) Issue resolved, see attachments: Gary Edit: removed attachments Edited February 7, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Valuater Posted February 5, 2006 Posted February 5, 2006 Issue resolved, see attachments: Gary are these missing commands Case $mnuExit ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$mnuExit" & @LF) ;---------------------------------------------------------------------------------------------- Case $mnuEdit ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$mnuEdit" & @LF) ;--------------------------------------------------------- all of the others have a command after the case?? 8)
GaryFrost Posted February 5, 2006 Posted February 5, 2006 are these missing commands Case $mnuExit ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$mnuExit" & @LF) ;---------------------------------------------------------------------------------------------- Case $mnuEdit ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$mnuEdit" & @LF) ;--------------------------------------------------------- all of the others have a command after the case?? 8) No missing commands, just no buttons were created for those, just menus, as you can see if you have menus, you also have to put them in the case of the WM_Command events. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted February 5, 2006 Posted February 5, 2006 (edited) Might want to change the constants to something like Global Const $IDM_OPEN = 2000 Global Const $IDM_NEW = 2001 Global Const $IDM_SAVE = 2002 Global Const $IDM_CUT = 2003 Global Const $IDM_COPY = 2004 Global Const $IDM_PASTE = 2005 Global Const $IDM_UNDO = 2006 Global Const $IDM_REDO = 2007 and add in the wm_command Case $button ;---------------------------------------------------------------------------------------------- If $DebugIt Then ConsoleWrite ("-->$button" & @LF) ;---------------------------------------------------------------------------------------------- Note: What would be great is a method of generating a unique id from autoit that won't be reused during the application runtime Just like when using the guictrlcreate's. Edited February 5, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
GaryFrost Posted February 6, 2006 Posted February 6, 2006 (edited) If the toolbar buttons are the same as the menu options then another option would be to create the menu items and use that id for toolbar buttons Example in attachment. Edit: Removed Attachment Edited February 7, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
tonedeaf Posted February 6, 2006 Author Posted February 6, 2006 (edited) Issue resolved, see attachments: GaryThanks Gary, I still don't understand the specific details about the _HiWord and _LoWord functions on wParam, but we need to hide this functionality in the UDF. The implementation should be completely transparent to user. And looks like $IDM_COPY, $mnuCopy message is getting generated for each action on the window (Activate, Deactivate, Minimize, Restore and on clicking Button). Using ImageList manipulation functions (Thanks: Holger), custom icons for toolbar images is now possible: EDIT: Only one mode is possible for one toolbar at a time, standard buttons images (from comctl32.dll) and custom images cannot be combined. Quoting MSDN: The TB_SETIMAGELIST message cannot be combined with TB_ADDBITMAP. When you create a toolbar with CreateToolbarEx or use TB_ADDBITMAP to add images, the toolbar manages the image list internally. Attempting to modify it with TB_SETIMAGELIST will have unpredictable consequences. Edited February 6, 2006 by tonedeaf
GaryFrost Posted February 6, 2006 Posted February 6, 2006 (edited) Thanks Gary,I still don't understand the specific details about the _HiWord and _LoWord functions on wParam, but we need to hide this functionality in the UDF. The implementation should be completely transparent to user.And looks like $IDM_COPY, $mnuCopy message is getting generated for each action on the window (Activate, Deactivate, Minimize, Restore and on clicking Button). Figured out that if _HiWord is 0 then switch Edit: Removed Attachment Edited February 7, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
tonedeaf Posted February 6, 2006 Author Posted February 6, 2006 (edited) Figured out that if _HiWord is 0 then switch The basic issues are all resolved now.Only thing left is to clean the code and adding functions for toolbar messages.EDIT: Double Quote Edited February 6, 2006 by tonedeaf
DaveF Posted February 6, 2006 Posted February 6, 2006 This is pretty fun, nice work, folks! Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.
GaryFrost Posted February 6, 2006 Posted February 6, 2006 (edited) Seperate Toolbar clicks from other control clicks Edit: Removed Attachment Edited February 7, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
tonedeaf Posted February 6, 2006 Author Posted February 6, 2006 Toolbars in Rebar:Rough script, I'll clean it later.
GaryFrost Posted February 6, 2006 Posted February 6, 2006 (edited) Toolbars in Rebar: Rough script, I'll clean it later. Cleaned up the Toolbar example some. Edit: Removed Attachment Edited February 7, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
DaveF Posted February 7, 2006 Posted February 7, 2006 I'm playing with the example, I get an off-by-one or off-by-two mistaken reply when clicking on the toolbar buttons, and it seems to be because the seperators are included in the indexed items. Is this something you've seen already? Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.
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