Rad Posted March 29, 2011 Share Posted March 29, 2011 (edited) I am in need of a workaround, as the script does not support a few functions (especially _DeleteAllItems) if I use the classic function. I've searched for a UDF version of GUICtrlSetPos but couldn't find one. Google and autoit forum search didn't help. What can I do? Here is an example, clearly they both should move together: #include <GUIConstantsEx.au3> #include <GuiListView.au3> $gui = GUICreate("") $w = 50 $list1 = _GUICtrlListView_Create($gui, "Lol", 0, 0, $w, 50) $list2 = GUICtrlCreateListView("Lol", 0, 70, $w, 50) $btn1 = GuiCtrlcreatebutton("-", 0, 50, 20, 20) $btn2 = GuiCtrlcreatebutton("+", 20, 50, 20, 20) guisetstate() while 1 $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE then Exit if $msg = $btn1 then $w -= 10 GUICtrlSetPos($list1, 0, 0, $w, 50) GUICtrlSetPos($list2, 0, 70, $w, 50) EndIf if $msg = $btn2 then $w += 10 GUICtrlSetPos($list1, 0, 0, $w, 50) GUICtrlSetPos($list2, 0, 70, $w, 50) EndIf sleep(10) WEnd Also a video showing why this is so annoying! It appears to resize the control, but the visible frame is not resized. http://www.screencast.com/users/RadGH/folders/Jing/media/9dea81df-23ab-4b66-aea2-be2a8c7e80d5 EDIT: Same result with GUI resizing mode Edited March 29, 2011 by Rad Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 29, 2011 Moderators Share Posted March 29, 2011 Rad,There is a fundamental difference between controls created by the native functions of AutoIt and those created by the UDFs. The former return a ControlID - which are actually index numbers to an internal AutoIt array which looks after them. UDFs return a handle - the unique windows ID for all things that Windows creates. Of course the native-created controls have handles too (that is why you have the GUICtrlGetHandle function ) but AutoIt shields the user from them.So you cannot use the standard Autoit GUICtrl* functions to interact with the UDF-created controls - they require a ControlID as a parameter which you do not have - you must use the Win* functions to interact as the following script shows. I also added a couple of lines to bring home the fact that the 2 Create functions return completely different types. Look for the <<<<<<<< lines: #include <GUIConstantsEx.au3> #include <GuiListView.au3> $gui = GUICreate("") $w = 50 $list1 = _GUICtrlListView_Create($gui, "Lol", 0, 0, $w, 50) ConsoleWrite($list1 & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $list2 = GUICtrlCreateListView("Lol", 0, 70, $w, 50) ConsoleWrite($list2 & @CRLF) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $btn1 = GuiCtrlcreatebutton("-", 0, 50, 20, 20) $btn2 = GuiCtrlcreatebutton("+", 20, 50, 20, 20) guisetstate() while 1 $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE then Exit if $msg = $btn1 then $w -= 10 WinMove($list1, "", 0, 0, $w, 50) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetPos($list2, 0, 70, $w, 50) EndIf if $msg = $btn2 then $w += 10 WinMove($list1, "", 0, 0, $w, 50) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetPos($list2, 0, 70, $w, 50) EndIf sleep(10) WEndAll clear? Please ask if not. 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...
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