Jump to content

clear listview columns and rows


Recommended Posts

Okay so basically I need something that will clear the listview and I don't even know where to start.

$ColdMagic = GUICtrlCreateCombo("", 20, 30, 255, 25, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "Cold|Fire");, IniRead($path, "gui_elements", "stat", "0"))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
guictrlsetonevent($coldmagic,"function1")
$listview = GUICtrlCreateListView ("Item Name      |Class|Price|Rqd Stats",10,60,305,300)
func function1()
    If GUICtrlRead($coldmagic) = "Cold" Then

Clearlistview() <<<< how would I do that

$ColdItem1=GUICtrlCreateListViewItem("Snowflake|1|12",$listview)
$ColdItem2=GUICtrlCreateListViewItem("Icecube|2|58",$listview)
$ColdItem3=GUICtrlCreateListViewItem("Snowball|3|180",$listview)
$ColdItem4=GUICtrlCreateListViewItem("Iceball|4|439",$listview)
$ColdItem5=GUICtrlCreateListViewItem("Vague Frost|5|908",$listview)
$ColdItem6=GUICtrlCreateListViewItem("Vague Icicle|6|1,682",$listview)
$ColdItem7=GUICtrlCreateListViewItem("Vague Freeze|7|2,868",$listview)
$ColdItem8=GUICtrlCreateListViewItem("Vague Cold Blast|8|4,594",$listview)
$ColdItem9=GUICtrlCreateListViewItem("Vague Glacier|9|7,001",$listview)
$ColdItem10=GUICtrlCreateListViewItem("Vague Blizzard|10|10,250",$listview)
$ColdItem11=GUICtrlCreateListViewItem("Small Frost|11|63,896",$listview)
$ColdItem12=GUICtrlCreateListViewItem("Small Icicle|12|96,810",$listview)
$ColdItem13=GUICtrlCreateListViewItem("Small Freeze|13|140,385",$listview)
$ColdItem14=GUICtrlCreateListViewItem("Small Cold Blast|14|196,927",$listview)
$ColdItem15=GUICtrlCreateListViewItem("Small Glacier|15|269,036",$listview)
elseif GUICtrlRead($coldmagic) = "Fire" then
$FireItem1=GUICtrlCreateListViewItem("Lighter|1|12",$listview)
$FireItem2=GUICtrlCreateListViewItem("Sparks|2|58",$listview)
$FireItem3=GUICtrlCreateListViewItem("Combustion|3|180",$listview)
$FireItem4=GUICtrlCreateListViewItem("Sear|4|439",$listview)
$FireItem5=GUICtrlCreateListViewItem("Vague Flame|5|908",$listview)
$FireItem6=GUICtrlCreateListViewItem("Vague Fireball|6|1,682",$listview)
$FireItem7=GUICtrlCreateListViewItem("Vague Blaze|7|2,868",$listview)
$FireItem8=GUICtrlCreateListViewItem("Vague Fire Blast|8|4,594",$listview)
$FireItem9=GUICtrlCreateListViewItem("Vague Scorch|9|7,001",$listview)
$FireItem10=GUICtrlCreateListViewItem("Vague Inferno|10|10,250",$listview)
$FireItem11=GUICtrlCreateListViewItem("Small Flame|11|63,896",$listview)
$FireItem12=GUICtrlCreateListViewItem("Small Fireball|12|96,810",$listview)
$FireItem13=GUICtrlCreateListViewItem("Small Blaze|13|140,385",$listview)
$FireItem14=GUICtrlCreateListViewItem("Small Fire Blast|14|196,927",$listview)
$FireItem15=GUICtrlCreateListViewItem("Small Scorch|15|269,036",$listview)
endif
Link to comment
Share on other sites

This is from Beta help 3.2.9.14

... and it works great

#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

Example_Internal()
Example_External()

Func Example_Internal()
    Local $hListView
    
    GUICreate("(Internal) ListView Delete All Items", 400, 300)

    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)
    GUICtrlCreateListViewItem("line1|data1|more1", $hListView)
    GUICtrlCreateListViewItem("line2|data2|more2", $hListView)
    GUICtrlCreateListViewItem("line3|data3|more3", $hListView)
    GUICtrlCreateListViewItem("line4|data4|more4", $hListView)
    GUICtrlCreateListViewItem("line5|data5|more5", $hListView)
    GUISetState()
    
    MsgBox(4160, "Information", "Delete All Items")
    _GUICtrlListView_DeleteAllItems($hListView)
    
    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example_Internal

Func Example_External()
    Local $GUI, $hListView, $aItems[10][3]
    
    $GUI = GUICreate("(External) ListView Delete All Items", 400, 300)

    $hListView = _GUICtrlListView_Create ($GUI, "col1|col2|col3", 2, 2, 394, 268)
    GUISetState()

    ; 3 column load
    For $iI = 0 To UBound($aItems) - 1
        $aItems[$iI][0] = "Item " & $iI
        $aItems[$iI][1] = "Item " & $iI & "-1"
        $aItems[$iI][2] = "Item " & $iI & "-2"
    Next

    _GUICtrlListView_AddArray ($hListView, $aItems)
    
    MsgBox(4160, "Information", "Delete All Items")
    _GUICtrlListView_DeleteAllItems($hListView)
    
    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example_External

... are you sure you "ran" it with Beta?

8)

NEWHeader1.png

Link to comment
Share on other sites

The UDF delete functions have been changed, and will stay that way.

If you create the items using the built-in create you need to use the the GuiCtrlDelete, otherwise use the UDF functions to create the items and then you can use the UDF delete functions.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

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