crislivinitup Posted May 5, 2010 Posted May 5, 2010 Hey guys, My problem is very simple. I have a lot of buttons and guictrls in my script. It would be nice if there was a syntax where a few buttons could call the same function but with a different result. It would save a lot of space and be much more efficient for me, especially when I can reuse code. I'm not sure if there is a way to call a function with guictrlsetonevent(-1,"myfunc") with parameters like, guictrlsetonevent(-1,"myfunc[2]") etc. It would be a very nice feature to include if it doesn't already exist. Is there a way to solve this problem?
picea892 Posted May 5, 2010 Posted May 5, 2010 Yes. Certainly this can be done. You need to investigate some of the autoit macros - specifically @GUI_CTRLID and @GUI_CTRLHANDLE When you a function is triggered via an onevent. These macros can be used to provide details on what triggered the event.
crislivinitup Posted May 5, 2010 Author Posted May 5, 2010 On 5/5/2010 at 2:32 PM, 'picea892 said: Yes. Certainly this can be done. You need to investigate some of the autoit macros - specifically @GUI_CTRLID and @GUI_CTRLHANDLEThank you very much for your information. Wow, this is very good news. Sadly, I've already put so much work into making seperate functions, there will be a lot of re-programming ahead of me. On, the plus side you gave me the answer I've been looking for . I only wish I knew sooner.
martin Posted May 5, 2010 Posted May 5, 2010 Usually those 2 macros, @GUI_CTRLID and @GUI_CTRLHANDLE, are all you need, but sometimes it is useful to have parameters in functions set by events. This it easier in my opinion when controls are created dynamically. Control events, gui events and Hotkeys call all have parameters using the SetOnEvent UDF which has a link in my signature. 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