Jump to content
Sign in to follow this  
Emiel Wieldraaijer

Use _GUICtrlListView_Create on Tabs

Recommended Posts

Hi,

is it possible to use _GUICtrlListView_Create on tabs?

Thnx

Best regards,

Emiel

Only if you put it on a child window.

Why not use the built-in create?


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Hi Gary,

thnx for the reply

i want to use _GUICtrlListView_DeleteAllItems to easily delete all items

i've created a listview based on the amount of fixed disk and with a button i want to add or delete removable disks

with deleteallitems it's a lot easier...

Emiel

Share this post


Link to post
Share on other sites

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView))

?

In the beta: _GUICtrlListView_DeleteAllItems($hListView) does work with both built-in and UDF created


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

@Gary

Thnx indeed it works in beta.. didn't see that ..

Too bad _GUICtrlListView_GetItemChecked isn't working with builtin listview

Works for me.

Straight from the help:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hListView
    
    GUICreate("ListView Get Item Checked State", 400, 300)
    $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
    GUISetState()
    
    ; Add columns
    _GUICtrlListView_AddColumn($hListView, "Column 1", 100)
    _GUICtrlListView_AddColumn($hListView, "Column 2", 100)
    _GUICtrlListView_AddColumn($hListView, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

    ; Check item 2
    _GUICtrlListView_SetItemChecked($hListView, 1)
    MsgBox(4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($hListView, 1))

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Hi Gary,

thnx

i made a mistake.. but i found the solution for those interrested .. a bit more advanced example then the help file

#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Global $RunButton, $totals, $spacef, $spaceu, $drives, $listview

$Drives = DriveGetDrive("FIXED")
Global $LVItems[$drives[0] + 1]

_Main()

Func _Main()
    GUICreate("ListView Get Item Checked State", 500, 350)
    GUICtrlCreateTab(5, 5, 490, 310)
    GUICtrlCreateTabItem ("Tab1")
    $ListView = GUICtrlCreateListView("Drive | Used Space | Free Space | Type",20, 40, 460, 258)
    _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
    
    $RunButton = GUICtrlCreateButton ("Run", 20, 325, 80, 20)
    GUISetState()
    
    
    For $i = 1 To $drives[0]
        $totals = Round(DriveSpaceTotal($drives[$i]) / 1024, 1)
        $spacef = Round(DriveSpaceFree($drives[$i]) / 1024, 1)
        $spaceu = $totals - $spacef
        $LVItems[$i] = GUICtrlCreateListViewItem(StringUpper($drives[$i]) & "|" & $spaceu & " GB" & "|" & $spacef & " GB" & "|" & DriveGetFileSystem($drives[$i]), $ListView)
    Next

    _GUICtrlListView_SetItemChecked($ListView, 0)

EndFunc


While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
    Switch $msg
        Case - 3
            ExitLoop
        Case - 50 To 0
            ContinueLoop
        Case $msg = $RunButton
            For $Count = 1 To UBound($LVItems) -1
                MsgBox(4160, "Information", "Item Checked: " & _GUICtrlListView_GetItemChecked($ListView, $Count -1))
            Next
    EndSwitch
WEnd
Edited by Emiel Wieldraaijer

Share this post


Link to post
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
Sign in to follow this  

×
×
  • Create New...