Jump to content

Search the Community

Showing results for tags '_GUICtrlListView_DeleteItem'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 2 results

  1. need some help, i have a listview. i want display the last item only and delete the previous item(s). for instance if i have 4 items i will delete item 1, 2,3 only the 4 item will be visible on the listview, the code below seems to work partly thanks ahead $aListViews = GUICtrlCreateListView("| UCS Subnet/ 28||", 76, 8, 361, 473, -1, BitOR($WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT)) ;56 if $Selection1 = True Then $noip = $sValueread ; load row in listview For $j = 1 To $noip GUICtrlCreateListViewItem('Static|SREI' & StringFormat('%05d', $checknum) & 'RE0' & $j & '|' & $ip2[UBound($ip2) - 1] + 15 + $j, $aListViews) ;GUICtrlCreateListViewItem('Static|Register ' & $j & '|' & $ip2[UBound($ip2) - 1] + 15 + $j, $alistviews) ConsoleWrite($j &"$noip"&@CRLF) Next ConsoleWrite(@CRLF) For $j=1 To $noip-1 _GUICtrlListView_DeleteItem($aListviews, $j) ; _GUICtrlListView_DeleteItemsSelected($aListviews) Next the attach example the max item was 2, it should have deleted item 1, only item 2 should have been visible on the listview
  2. First of all, I am starting with GUIs but reading examples from the helpfile as well as the forum I made an script in which I have a listview that is going to be populated with user input and sorted at any given moment. When I sort it by the first or second column with the data that was already set when starting the script (1|D,2|C,4|A,3|D ) It sorts correctly but when I add a new element it doesn't sort it right, it seems it dismisses the new entered data. Here is a small example of my code to show the issue: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $Form1_1 = GUICreate("Form1", 969, 569, 209, 134) $ListView1 = GUICtrlCreateListView("Col1|Col2", 32, 128, 353, 321, -1, $LVS_EX_CHECKBOXES) _GUICtrlListView_RegisterSortCallBack($ListView1) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 115) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 115) $ListView1_0 = GUICtrlCreateListViewItem("1|D", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("2|C", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("4|A", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("3|B", $ListView1) $bElim = GUICtrlCreateButton("Delete element(s)", 176, 464, 201, 25) $elem = GUICtrlCreateInput("Element", 88, 16, 241, 21) $bAdd = GUICtrlCreateButton("Add letter", 112, 48, 201, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GUICtrlListView_UnRegisterSortCallBack($ListView1) Exit Case $ListView1 _GUICtrlListView_SortItems($ListView1, GUICtrlGetState($ListView1)) Case $bElim $i = 0 $cantitems = _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView1)) While $i <= $cantitems If _GUICtrlListView_GetItemChecked(GUICtrlGetHandle($ListView1), $i) Then _GUICtrlListView_DeleteItem(GUICtrlGetHandle($ListView1), $i) Else $i += 1 EndIf WEnd Case $bAdd $number = Random(0, 100, 1) $handlelista = GUICtrlGetHandle($ListView1) _GUICtrlListView_AddItem($handlelista, $number) _GUICtrlListView_AddSubItem($handlelista, _GUICtrlListView_GetItemCount(GUICtrlGetHandle($ListView1)) - 1, GUICtrlRead($elem), 1) EndSwitch WEnd Note that if you delete all the elements that are set after the script started and you add new ones, it doesn't sort them. What's wrong? Thanks for your help!
×
×
  • Create New...