1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.dataview.DataViewListCtrl:
==========================================================================================================================================
|phoenix_title| **wx.dataview.DataViewListCtrl**
==========================================================================================================================================
This class is a :ref:`wx.dataview.DataViewCtrl` which internally uses a :ref:`wx.dataview.DataViewListStore` and forwards most of its API to that class.
The purpose of this class is to offer a simple way to display and edit a small table of data without having to write your own :ref:`wx.dataview.DataViewModel`.
::
listctrl = wx.dataview.DataViewListCtrl(parent, wx.ID_ANY)
listctrl.AppendToggleColumn("Toggle")
listctrl.AppendTextColumn("Text")
data = [True, "row 1"]
listctrl.AppendItem(data)
data = [False, "row 3"]
listctrl.AppendItem(data)
.. _DataViewListCtrl-styles:
|styles| Window Styles
================================
This class supports the following styles:
See :ref:`wx.dataview.DataViewCtrl` for the list of supported styles.
.. _DataViewListCtrl-events:
|events| Events Emitted by this Class
=====================================
Event macros for events emitted by this class:
See :ref:`wx.dataview.DataViewCtrl` for the list of events emitted by this class.
.. versionadded:: 2.9.0
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>DataViewListCtrl</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.dataview.DataViewListCtrl_inheritance.png" alt="Inheritance diagram of DataViewListCtrl" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Control.html" title="wx.Control" alt="" coords="69,237,157,267"/> <area shape="rect" id="node7" href="wx.dataview.DataViewCtrl.html" title="wx.dataview.DataViewCtrl" alt="" coords="22,315,204,344"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="69,160,157,189"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="5,5,107,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="57,83,168,112"/> <area shape="rect" id="node4" href="wx.Object.html" title="wx.Object" alt="" coords="131,5,212,35"/> <area shape="rect" id="node6" href="wx.dataview.DataViewListCtrl.html" title="wx.dataview.DataViewListCtrl" alt="" coords="11,392,216,421"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewListCtrl.__init__` Default constructor.
:meth:`~wx.dataview.DataViewListCtrl.AppendColumn` Appends a column to the control and additionally appends a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.AppendIconTextColumn` Appends an icon-and-text column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendItem` Appends an item (=row) to the control and store.
:meth:`~wx.dataview.DataViewListCtrl.AppendProgressColumn` Appends a progress column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendTextColumn` Appends a text column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.AppendToggleColumn` Appends a toggle column to the control and the store.
:meth:`~wx.dataview.DataViewListCtrl.Create` Creates the control and a :ref:`wx.dataview.DataViewListStore` as its internal model.
:meth:`~wx.dataview.DataViewListCtrl.DeleteAllItems` Delete all items (= all rows).
:meth:`~wx.dataview.DataViewListCtrl.DeleteItem` Delete the row at position `row`.
:meth:`~wx.dataview.DataViewListCtrl.GetItemCount` Returns the number of items (=rows) in the control.
:meth:`~wx.dataview.DataViewListCtrl.GetItemData` Returns the client data associated with the item.
:meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow` Returns index of the selected row or ``wx.NOT_FOUND``.
:meth:`~wx.dataview.DataViewListCtrl.GetStore` Returns the store.
:meth:`~wx.dataview.DataViewListCtrl.GetTextValue` Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.GetToggleValue` Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.GetValue` Returns the value from the store.
:meth:`~wx.dataview.DataViewListCtrl.InsertColumn` Inserts a column to the control and additionally inserts a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.InsertItem` Inserts an item (=row) to the control and store.
:meth:`~wx.dataview.DataViewListCtrl.IsRowSelected` Returns ``True`` if `row` is selected.
:meth:`~wx.dataview.DataViewListCtrl.ItemToRow` Returns the position of given `item` or ``wx.NOT_FOUND`` if it's not a valid item.
:meth:`~wx.dataview.DataViewListCtrl.PrependColumn` Prepends a column to the control and additionally prepends a column to the store with the type string.
:meth:`~wx.dataview.DataViewListCtrl.PrependItem` Prepends an item (=row) to the control and store.
:meth:`~wx.dataview.DataViewListCtrl.RowToItem` Returns the :ref:`wx.dataview.DataViewItem` at the given `row`.
:meth:`~wx.dataview.DataViewListCtrl.SelectRow` Selects given row.
:meth:`~wx.dataview.DataViewListCtrl.SetItemData` Associates a client data pointer with the given item.
:meth:`~wx.dataview.DataViewListCtrl.SetTextValue` Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.SetToggleValue` Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.SetValue` Sets the value in the store and update the control.
:meth:`~wx.dataview.DataViewListCtrl.UnselectRow` Unselects given row.
================================================================================ ================================================================================
|
|property_summary| Properties Summary
=====================================
================================================================================ ================================================================================
:attr:`~wx.dataview.DataViewListCtrl.ItemCount` See :meth:`~wx.dataview.DataViewListCtrl.GetItemCount`
:attr:`~wx.dataview.DataViewListCtrl.SelectedRow` See :meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow`
:attr:`~wx.dataview.DataViewListCtrl.Store` See :meth:`~wx.dataview.DataViewListCtrl.GetStore`
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.dataview.DataViewListCtrl(DataViewCtrl)
**Possible constructors**::
DataViewListCtrl()
DataViewListCtrl(parent, id=ID_ANY, pos=DefaultPosition,
size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)
This class is a DataViewCtrl which internally uses a
DataViewListStore and forwards most of its API to that class.
.. method:: __init__(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**__init__** `(self)`
Default constructor.
**~~~**
**__init__** `(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)`
Constructor.
Calls :meth:`Create` .
:param `parent`:
:type `parent`: wx.Window
:param `id`:
:type `id`: wx.WindowID
:param `pos`:
:type `pos`: wx.Point
:param `size`:
:type `size`: wx.Size
:param `style`:
:type `style`: long
:param `validator`:
:type `validator`: wx.Validator
**~~~**
.. method:: AppendColumn(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**AppendColumn** `(self, column)`
Appends a column to the control and additionally appends a column to the store with the type string.
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:rtype: `bool`
**~~~**
**AppendColumn** `(self, column, varianttype)`
Appends a column to the control and additionally appends a column to the list store with the type `varianttype`.
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:param `varianttype`:
:type `varianttype`: string
**~~~**
.. method:: AppendIconTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)
Appends an icon-and-text column to the control and the store.
See :meth:`DataViewColumn.__init__` for more info about the parameters.
:param `label`:
:type `label`: string
:param `mode`:
:type `mode`: wx.dataview.DataViewCellMode
:param `width`:
:type `width`: int
:param `align`:
:type `align`: wx.Alignment
:param `flags`:
:type `flags`: int
:rtype: :ref:`wx.dataview.DataViewColumn`
.. method:: AppendItem(self, values, data=None)
Appends an item (=row) to the control and store.
:param `values`:
:type `values`: :class:`VariantVector`
:param `data`:
:type `data`: wx.UIntPtr
.. method:: AppendProgressColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)
Appends a progress column to the control and the store.
See :meth:`DataViewColumn.__init__` for more info about the parameters.
:param `label`:
:type `label`: string
:param `mode`:
:type `mode`: wx.dataview.DataViewCellMode
:param `width`:
:type `width`: int
:param `align`:
:type `align`: wx.Alignment
:param `flags`:
:type `flags`: int
:rtype: :ref:`wx.dataview.DataViewColumn`
.. method:: AppendTextColumn(self, label, mode=DATAVIEW_CELL_INERT, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)
Appends a text column to the control and the store.
See :meth:`DataViewColumn.__init__` for more info about the parameters.
:param `label`:
:type `label`: string
:param `mode`:
:type `mode`: wx.dataview.DataViewCellMode
:param `width`:
:type `width`: int
:param `align`:
:type `align`: wx.Alignment
:param `flags`:
:type `flags`: int
:rtype: :ref:`wx.dataview.DataViewColumn`
.. method:: AppendToggleColumn(self, label, mode=DATAVIEW_CELL_ACTIVATABLE, width=-1, align=ALIGN_LEFT, flags=DATAVIEW_COL_RESIZABLE)
Appends a toggle column to the control and the store.
See :meth:`DataViewColumn.__init__` for more info about the parameters.
:param `label`:
:type `label`: string
:param `mode`:
:type `mode`: wx.dataview.DataViewCellMode
:param `width`:
:type `width`: int
:param `align`:
:type `align`: wx.Alignment
:param `flags`:
:type `flags`: int
:rtype: :ref:`wx.dataview.DataViewColumn`
.. method:: Create(self, parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=DV_ROW_LINES, validator=DefaultValidator)
Creates the control and a :ref:`wx.dataview.DataViewListStore` as its internal model.
:param `parent`:
:type `parent`: wx.Window
:param `id`:
:type `id`: wx.WindowID
:param `pos`:
:type `pos`: wx.Point
:param `size`:
:type `size`: wx.Size
:param `style`:
:type `style`: long
:param `validator`:
:type `validator`: wx.Validator
:rtype: `bool`
.. method:: DeleteAllItems(self)
Delete all items (= all rows).
.. method:: DeleteItem(self, row)
Delete the row at position `row`.
:param `row`:
.. method:: GetItemCount(self)
Returns the number of items (=rows) in the control.
:rtype: `int`
.. versionadded:: 2.9.4
.. method:: GetItemData(self, item)
Returns the client data associated with the item.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: :ref:`wx.UIntPtr`
.. versionadded:: 2.9.4
.. seealso:: :meth:`SetItemData`
.. method:: GetSelectedRow(self)
Returns index of the selected row or ``wx.NOT_FOUND``.
:rtype: `int`
.. versionadded:: 2.9.2
.. seealso:: :meth:`wx.dataview.DataViewCtrl.GetSelection`
.. method:: GetStore(self)
Returns the store.
:rtype: :ref:`wx.dataview.DataViewListStore`
.. method:: GetTextValue(self, row, col)
Returns the value from the store.
This method assumes that the string is stored in respective column.
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
:rtype: `string`
.. method:: GetToggleValue(self, row, col)
Returns the value from the store.
This method assumes that the boolean value is stored in respective column.
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
:rtype: `bool`
.. method:: GetValue(self, row, col)
Returns the value from the store.
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
:rtype: `value`
.. method:: InsertColumn(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**InsertColumn** `(self, pos, column)`
Inserts a column to the control and additionally inserts a column to the store with the type string.
:param `pos`:
:type `pos`: int
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:rtype: `bool`
**~~~**
**InsertColumn** `(self, pos, column, varianttype)`
Inserts a column to the control and additionally inserts a column to the list store with the type `varianttype`.
:param `pos`:
:type `pos`: int
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:param `varianttype`:
:type `varianttype`: string
**~~~**
.. method:: InsertItem(self, row, values, data=None)
Inserts an item (=row) to the control and store.
:param `row`:
:type `row`: int
:param `values`:
:type `values`: :class:`VariantVector`
:param `data`:
:type `data`: wx.UIntPtr
.. method:: IsRowSelected(self, row)
Returns ``True`` if `row` is selected.
:param `row`:
:rtype: `bool`
.. versionadded:: 2.9.2
.. seealso:: :meth:`wx.dataview.DataViewCtrl.IsSelected`
.. method:: ItemToRow(self, item)
Returns the position of given `item` or ``wx.NOT_FOUND`` if it's not a valid item.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:rtype: `int`
.. versionadded:: 2.9.2
.. method:: PrependColumn(self, *args, **kw)
|overload| Overloaded Implementations:
**~~~**
**PrependColumn** `(self, column)`
Prepends a column to the control and additionally prepends a column to the store with the type string.
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:rtype: `bool`
**~~~**
**PrependColumn** `(self, column, varianttype)`
Prepends a column to the control and additionally prepends a column to the list store with the type `varianttype`.
:param `column`:
:type `column`: wx.dataview.DataViewColumn
:param `varianttype`:
:type `varianttype`: string
**~~~**
.. method:: PrependItem(self, values, data=None)
Prepends an item (=row) to the control and store.
:param `values`:
:type `values`: :class:`VariantVector`
:param `data`:
:type `data`: wx.UIntPtr
.. method:: RowToItem(self, row)
Returns the :ref:`wx.dataview.DataViewItem` at the given `row`.
:param `row`:
:type `row`: int
:rtype: :ref:`wx.dataview.DataViewItem`
.. versionadded:: 2.9.2
.. method:: SelectRow(self, row)
Selects given row.
:param `row`:
.. versionadded:: 2.9.2
.. seealso:: :meth:`wx.dataview.DataViewCtrl.Select`
.. method:: SetItemData(self, item, data)
Associates a client data pointer with the given item.
Notice that the control does `not` take ownership of the pointer for compatibility with :ref:`wx.ListCtrl`. I.e. it will `not` delete the pointer (if it is a pointer and not a number) itself, it is up to you to do it.
:param `item`:
:type `item`: wx.dataview.DataViewItem
:param `data`:
:type `data`: wx.UIntPtr
.. versionadded:: 2.9.4
.. seealso:: :meth:`GetItemData`
.. method:: SetTextValue(self, value, row, col)
Sets the value in the store and update the control.
This method assumes that the string is stored in respective column.
:param `value`:
:type `value`: string
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
.. method:: SetToggleValue(self, value, row, col)
Sets the value in the store and update the control.
This method assumes that the boolean value is stored in respective column.
:param `value`:
:type `value`: bool
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
.. method:: SetValue(self, value, row, col)
Sets the value in the store and update the control.
:param `value`:
:type `value`: DVCVariant
:param `row`:
:type `row`: int
:param `col`:
:type `col`: int
.. method:: UnselectRow(self, row)
Unselects given row.
:param `row`:
.. versionadded:: 2.9.2
.. seealso:: :meth:`wx.dataview.DataViewCtrl.Unselect`
.. attribute:: ItemCount
See :meth:`~wx.dataview.DataViewListCtrl.GetItemCount`
.. attribute:: SelectedRow
See :meth:`~wx.dataview.DataViewListCtrl.GetSelectedRow`
.. attribute:: Store
See :meth:`~wx.dataview.DataViewListCtrl.GetStore`
|