Jump to content

Differences between UDFs and regular GUI creation


Armag3ddon
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...