Differences between UDFs and regular GUI creation
Posted 19 February 2012 - 04:46 PM
I'm going crazy here. Over and over again I run into difficulties because the UDFs for gui creation and the regular gui creation functions of AutoIT apparently don't do the same. This is really freaking me out.
The first thing I mentioned was that whenever I use a _GUICtrlX_Create() function I simply can't use GUICtrlSetOnEvent on it! This is a huge disadvantage when using OnEventMode (everything else would be horrible in my case).
Now I wanted to use the the following script in my GUI because hey! it's useful and stuff: http://www.autoitscript.com/forum/topic/116242-sorting-treeview/page__view__findpost__p__811311
But Authenticity uses GUICtrlCreateTreeView and GUICtrlCreateTreeViewItem in his example and after hours of enraged testing I found out that this was for a reason: the whole thing doesn't work with _GUICtrlTreeView_AddChild!
So by now I really came to hate the UDFs. Is there any way to make up these weird behaviour? I don't want to change everything again and again whenever I encounter a feature that requires the one or the other creation process
Posted 19 February 2012 - 05:35 PM
You must be writing some very complex code if this causes you so much angst.
Remember that the native Autoit GUICtrlCreate* functions make AutoIt do a lot of the normal housekeeping duties that you would otherwise have to code yourself - hiding the elements on different tabs for example.
The various GUICtrl* functions are obviously designed to work these controls - that is why they take a ControlID (as returned by the GUICtrlCreate* functions) and not a handle (which is what you get from the UDFs which deal directly with the API). And, as you have discovered, they will not work on the UDF-created controls for this very reason. Incidentally, the ControlID is the index of the control in an internal array of natively-created controls maintained within AutoIt.
You can often (but not always) use the UDF functions on natively-created controls - it all depends on the control itself. Complex things like TreeViews and ListViews are the most likely to give you problems, as you have again discovered.
Now you have got that rant out of your system and I have explained why these things happen, I hope you come to realise the value of having both sets of functions. I would recommend trying to use the natively-created controls if you can - it means you can use the full range of AutoIt native functions on them, as well as many of the UDF functions.
Enjoy what is left of your weekend.
Toast - Small GUIs which pop out of the Systray   Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI   NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure   Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language   GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items
Posted 19 February 2012 - 05:49 PM
Yes, the angst level was very high at that point. I've arranged with the OnEvent stuff. I was just happy to have found a custom sort function for treeview but then was sad that it doesn't work
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users