mistersquirrle Posted January 23, 2011 Share Posted January 23, 2011 (edited) So, I'm using the UDF to create a label that has formatted text, which creates a bunch of smaller labels with the text in different formats in different labels, so it returns the label as an array.So if you used $Label1 = _GUICtrlCreateTFLabel(blah blah) and had a couple different type of formatted text, it would return $Label1[5] or something. My problem is that I used an array as the variable in the first place, and I don't know how to call the variable of the labels returned in *the* array that the UDF created. When I try what I think, it just crashes.Sorry if this isn't very clear, I don't really know what the problem is myself.Here's an example of what I'm talking about, you need the UDF, in the script dir, above for it to run.#include-once #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include "GUICtrlCreateTFLabel.au3" #include <Array.au3> Global $Label1[3] $Form1 = GUICreate("asdf", 617, 441, 192, 124) $Label1[0] = _GUICtrlCreateTFLabel("LABEL!", 56, 80) $Label2 = GUICtrlCreateLabel("Try to show a msgbox with $Label1[0][1] as the text... (click this)" & @CRLF & @CRLF & "I just figured that this should be the format ( $label1[0][1]) since $label1[0] has an array attached to it...", 56, 120) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xffffff) GUISetState(@SW_SHOW) _ArrayDisplay($Label1, "$Label1 display") _ArrayDisplay($Label1[0], "$Label1[0] display") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Label2 MsgBox(0, '', $Label1[0][1]) EndSwitch WEnd Edited January 23, 2011 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Fubarable Posted January 23, 2011 Share Posted January 23, 2011 (edited) As far as I understand it, a single dimensional array which holds other dimensional array items is not the same animal as a two dimensional array. I believe that AutoIt does not work the same as Java for instance in this regard. I am certainly no pro at this, but what if you did something like... Case $Label2 Local $myLabel[1] $myLabel = $label1[0] MsgBox(0, '', $myLabel[1]) ;;MsgBox(0, '', $Label1[0][1]) Edited January 23, 2011 by Fubarable Link to comment Share on other sites More sharing options...
mistersquirrle Posted January 23, 2011 Author Share Posted January 23, 2011 So you're saying that I can't do what I'm trying, in AutoIt? Why can I then parse the info with _ArrayDisplay() from $Label1[0], and why is it different than the 0 index of $Label[3] We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 23, 2011 Moderators Share Posted January 23, 2011 mistersquirrle, I have answered in more detail here in the Examples thread for the UDF as I saw that one first. Basically Fubarable is correct. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mistersquirrle Posted January 23, 2011 Author Share Posted January 23, 2011 (edited) Yeah, thanks Melba and Fubarable. I didn't see Fubarables edit until a few hours after he posted it so I was to tried to respond and say that that worked. If a mod wants put [sOLVED] or something, then feel free Edited January 23, 2011 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 23, 2011 Moderators Share Posted January 23, 2011 mistersquirrle,You can add [sOLVED] yourself if you wish. Just edit the first post and select the "Use Full Editor" option - that allows you to edit the title as well. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
mistersquirrle Posted January 23, 2011 Author Share Posted January 23, 2011 Heh, thanks again Melba. We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
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