Jump to content

Default exStyle value for wrapping CreateListView


Recommended Posts

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

Link to comment
Share on other sites

default exstyle is WS_EX_CLIENTEDGE | LVS_EX_FULLROWSELECT

I hope that's answer your question :)

<{POST_SNAPBACK}>

Yup! That worked perfectly. Here is the final code for the func

; ----------------------------------------------------------------------------
;
; 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  ;==>GuiCtrlCreateListViewFromArray

Thanks for the help. I will post the final udf to the scrips and scraps forum.

Link to comment
Share on other sites

  • 6 years later...

default exstyle is WS_EX_CLIENTEDGE | LVS_EX_FULLROWSELECT

It 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

 

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