Michael.Curley Posted April 11, 2005 Posted April 11, 2005 While creating a UDF to wrap around GuiCtrlCreateListView and GuiCtrlCreateListViewItem. GuiCtrlCreateListViewFromArray($ArrayIn, $Left, $Top, $Width = "", $Height = "", $Style = "", $exStyle = "") To create a listview fully populate by a 2 dimensional array, I have run into a problem passing $exStyle when it is undefined at Func GuiCtrlCreateListViewFromArray() calling. as below... $ArrayOut[0] = GUICtrlCreateListView($TempStr, $Left, $Top, $Width, $Height, $Style, $exStyle) The list view it creates has no border, and when the GUI is not "on top" it has a tendency to disappear until one clicks somewhere on it, and then it only "partially" I tried putting the below in to correct it. If $Style = "" Then $Style = $GUI_SS_DEFAULT_LISTVIEW If $exStyle = "" Then $exStyle = 0 But it had little to no impact because I could not find a constant to reference for exStyle.... I changed the creation code to read $ArrayOut[0] = GUICtrlCreateListView($TempStr, $Left, $Top, $Width, $Height, $Style);, $exStyle) And it now draws a stable listview with the appropiate borders and whatnot... but I would like the UDF to be able to accept and use extended styles, just in case anyone ever wants to use it. Any ideas on what the default extended style is (should be), or did I just miss the constant for it? R- Mike Curley
jpm Posted April 11, 2005 Posted April 11, 2005 default exstyle is WS_EX_CLIENTEDGE | LVS_EX_FULLROWSELECT I hope that's answer your question
Michael.Curley Posted April 11, 2005 Author Posted April 11, 2005 default exstyle is WS_EX_CLIENTEDGE | LVS_EX_FULLROWSELECTI hope that's answer your question <{POST_SNAPBACK}>Yup! That worked perfectly. Here is the final code for the funcexpandcollapse popup; ---------------------------------------------------------------------------- ; ; AutoIt Version: 3.1.0 ; Author: Michael Curley (Michael.Curley@XDCTech.com) ; ; Script Function: ; Creates a ListView from a 2 dimensional array of data (with Array[0] being the labels) ; and returns an array of handles with Array[0] being the handle for the listview ; and Array[i>0] being the handles for each listview item. ; ; ---------------------------------------------------------------------------- ; Script Start - Add your code below here #Include <GUIConstants.au3> Func GuiCtrlCreateListViewFromArray($ArrayIn, $Left, $Top, $Width = "", $Height = "", $Style = "", $exStyle = "") If Not (UBound($ArrayIn, 0) = 2) Then SetError(-1) Return "" EndIf If $Style = "" Then $Style = $GUI_SS_DEFAULT_LISTVIEW If $exStyle = "" Then $exStyle = $WS_EX_CLIENTEDGE + $LVS_EX_FULLROWSELECT Local $Ubound1 = UBound($ArrayIn, 1) Local $Ubound2 = UBound($ArrayIn, 2) Local $ArrayOut[$Ubound1] Local $TempStr Local $i Local $j $TempStr = $ArrayIn[0][0] For $j = 1 To $Ubound2 - 1 $TempStr = $TempStr & "|" & $ArrayIn[0][$j] Next $ArrayOut[0] = GUICtrlCreateListView($TempStr, $Left, $Top, $Width, $Height, $Style, $exStyle) For $i = 1 To $Ubound1 - 1 $TempStr = $ArrayIn[$i][0] For $j = 1 To $Ubound2 - 1 $TempStr = $TempStr & "|" & $ArrayIn[$i][$j] Next $ArrayOut[$i] = GUICtrlCreateListViewItem($TempStr & "|", $ArrayOut[0]) Next Return $ArrayOut EndFunc ;==>GuiCtrlCreateListViewFromArrayThanks for the help. I will post the final udf to the scrips and scraps forum.
c.haslam Posted July 13, 2011 Posted July 13, 2011 default exstyle is WS_EX_CLIENTEDGE | LVS_EX_FULLROWSELECTIt is unfortunate that the AutoIt help doesn't tell us the forced and default exStyles.My testing suggests that LVS_EX_FULLROWSELECT is forced, rather than default. Am I correct? Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
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