Sign in to follow this  
Followers 0

Differences between UDFs and regular GUI creation

3 posts in this topic

Posted

Hi everyone ;)

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:

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 :)

Share this post


Link to post
Share on other sites



Posted

Armag3ddon,

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. :D

M23

Share this post


Link to post
Share on other sites

Posted

Thanks for the calming words ;)

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 :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0