Class: Wx::ListCtrl

Inherits:
Control show all
Includes:
Enumerable
Defined in:
lib/wx/doc/gen/list_ctrl.rb,
lib/wx/doc/list_ctrl.rb

Overview

A list control presents lists in a number of formats: list view, report view, icon view and small icon view.

In any case, elements are numbered from zero. For all these modes, the items are stored in the control and must be added to it using #insert_item method. A special case of report view quite different from the other modes of the list control is a virtual control in which the items data (including text, images and attributes) is managed by the main program and is requested by the control itself only when needed which allows having controls with millions of items without consuming much memory. To use virtual list control you must use #set_item_count first and override at least #on_get_item_text (and optionally #on_get_item_image or #on_get_item_column_image and #on_get_item_attr) to return the information about the items when the control requests it. Virtual list control can be used as a normal one except that no operations which can take time proportional to the number of items in the control happen this is required to allow having a practically infinite number of items. For example, in a multiple selection virtual list control, the selections won’t be sent when many items are selected at once because this could mean iterating over all the items. Using many of ListCtrl features is shown in the corresponding sample. To intercept events from a list control, use the event table macros described in ListEvent.

Note:

The native WXOSX implementation for report mode that was added in wxWidgets 2.8 was removed in wxWidgets 3.1, meaning for wxWidgets 3.1+ WXOSX uses the generic implementation for all modes.

Column Ordering

By default, the columns of a list control appear on the screen in order of their indices, i.e. column 0 appears first, then column 1 next, and so on. However this can be changed by using the #set_columns_order function to arbitrarily reorder the columns visual order. The user can also rearrange the columns interactively by dragging them. In this case, the index of the column is not the same as its order and the functions #get_column_order and #get_column_index_from_order should be used to translate between them.

Note:

All the other functions still work with the column indices, i.e. the visual positioning of the columns on screen doesn't affect the code setting or getting their values for example.

Example of reordering columns:

list = Wx::ListCtrl.new(...)
  3.times { |i| list.insert_column(i, "Column #{i}") }
  
  order = [2, 0, 1]
  list.set_columns_order(order)
  
  # now list.get_columns_order() will return order and
  # list.get_column_index_from_order(n) will return order[n] and
  # list.get_column_order() will return 1, 2 and 0 for the column 0,
  # 1 and 2 respectively

Styles

This class supports the following styles:

  • LC_LIST: Multicolumn list view, with optional small icons. Columns are computed automatically, i.e. you don't set columns as in LC_REPORT. In other words, the list wraps, unlike a ListBox.

  • LC_REPORT: Single or multicolumn report view, with optional header.

  • LC_VIRTUAL: The application provides items text on demand. May only be used with LC_REPORT.

  • LC_ICON: Large icon view, with optional labels.

  • LC_SMALL_ICON: Small icon view, with optional labels.

  • LC_ALIGN_TOP: Icons align to the top. Win32 default, Win32 only.

  • LC_ALIGN_LEFT: Icons align to the left.

  • LC_AUTOARRANGE: Icons arrange themselves. Win32 only.

  • LC_EDIT_LABELS: Labels are editable: the application will be notified when editing starts.

  • LC_NO_HEADER: No header in report mode.

  • LC_SINGLE_SEL: Single selection (default is multiple).

  • LC_SORT_ASCENDING: Sort in ascending order. (You must still supply a comparison callback in #sort_items.)

  • LC_SORT_DESCENDING: Sort in descending order. (You must still supply a comparison callback in #sort_items.)

  • LC_HRULES: Draws light horizontal rules between rows in report mode.

  • LC_VRULES: Draws light vertical rules between columns in report mode.

Events emitted by this class

The following event-handler methods redirect the events to member method or handler blocks for ListEvent events. Event handler methods for events emitted by this class:

Note:

Under WXMSW this control uses SystemThemedControl for an explorer style appearance by default since wxWidgets 3.1.0. If this is not desired, you can call Wx::SystemThemedControl::EnableSystemTheme with false argument to disable this.

Category: Controls <div class=‘appearance’><span class=‘appearance’>Appearance:</span><table><tr><td> WXMSW Appearance </td><td> WXGTK Appearance </td><td> WXOSX Appearance </td></tr></table></div>

See Also:

Requires:

  • USE_LISTCTRL

Direct Known Subclasses

ListView

Instance Method Summary collapse

Methods inherited from Control

#command, ellipsize, escape_mnemonics, #get_label, #get_label_text, #get_size_from_text, #get_size_from_text_size, remove_mnemonics, #set_label, #set_label_markup, #set_label_text

Methods inherited from Window

#accepts_focus, #accepts_focus_from_keyboard, #accepts_focus_recursively, #add_child, #adjust_for_layout_direction, #always_show_scrollbars, #begin_repositioning_children, #cache_best_size, #can_accept_focus, #can_accept_focus_from_keyboard, #can_scroll, #can_set_transparent, #capture_mouse, #center, #center_on_parent, #centre, #centre_on_parent, #clear_background, #client_to_screen, #client_to_window_size, #close, #convert_dialog_to_pixels, #convert_pixels_to_dialog, #destroy, #destroy_children, #disable, #disable_focus_from_keyboard, #do_update_window_ui, #drag_accept_files, #each_child, #enable, #enable_touch_events, #enable_visible_focus, #end_repositioning_children, find_focus, #find_window_by_id, find_window_by_id, #find_window_by_label, find_window_by_label, #find_window_by_name, find_window_by_name, #fit, #fit_inside, #freeze, #from_dip, from_dip, #from_phys, from_phys, #get_accelerator_table, #get_auto_layout, #get_background_colour, #get_background_style, #get_best_height, #get_best_size, #get_best_virtual_size, #get_best_width, #get_border, get_capture, #get_caret, #get_char_height, #get_char_width, #get_children, get_class_default_attributes, #get_client_area_origin, #get_client_rect, #get_client_size, #get_containing_sizer, #get_content_scale_factor, #get_cursor, #get_default_attributes, #get_dpi, #get_dpi_scale_factor, #get_drop_target, #get_effective_min_size, #get_event_handler, #get_extra_style, #get_font, #get_foreground_colour, #get_grand_parent, #get_help_text, #get_help_text_at_point, #get_id, #get_label, #get_layout_direction, #get_max_client_size, #get_max_height, #get_max_size, #get_max_width, #get_min_client_size, #get_min_height, #get_min_size, #get_min_width, #get_name, #get_next_sibling, #get_parent, #get_popup_menu_selection_from_user, #get_position, #get_prev_sibling, #get_rect, #get_screen_position, #get_screen_rect, #get_scroll_pos, #get_scroll_range, #get_scroll_thumb, #get_size, #get_sizer, #get_text_extent, #get_theme_enabled, #get_tool_tip, #get_tool_tip_text, #get_update_client_rect, #get_update_region, #get_validator, #get_virtual_size, #get_window_border_size, #get_window_style, #get_window_style_flag, #get_window_variant, #handle_as_navigation_key, #handle_window_event, #has_capture, #has_extra_style, #has_flag, #has_focus, #has_multiple_pages, #has_scrollbar, #has_transparent_background, #hide, #hide_with_effect, #inform_first_direction, #inherit_attributes, #inherits_background_colour, #inherits_foreground_colour, #init_dialog, #invalidate_best_size, #is_being_deleted, #is_descendant, #is_double_buffered, #is_enabled, #is_exposed, #is_focusable, #is_frozen, #is_retained, #is_scrollbar_always_shown, #is_shown, #is_shown_on_screen, #is_this_enabled, #is_top_level, #is_transparent_background_supported, #layout, #line_down, #line_up, #locked, #lower_window, #move, #move_after_in_tab_order, #move_before_in_tab_order, #navigate, #navigate_in, new_control_id, #on_internal_idle, #page_down, #page_up, #paint, #paint_buffered, #popup_menu, #post_size_event, #post_size_event_to_parent, #process_window_event, #process_window_event_locally, #push_event_handler, #raise_window, #refresh, #refresh_rect, #register_hot_key, #release_mouse, #remove_child, #remove_event_handler, #reparent, #screen_to_client, #scroll_lines, #scroll_pages, #scroll_window, #send_size_event, #send_size_event_to_parent, #set_accelerator_table, #set_auto_layout, #set_background_style, #set_can_focus, #set_caret, #set_client_size, #set_containing_sizer, #set_cursor, #set_double_buffered, #set_drop_target, #set_event_handler, #set_extra_style, #set_focus, #set_focus_from_kbd, #set_font, #set_foreground_colour, #set_help_text, #set_id, #set_initial_size, #set_label, #set_layout_direction, #set_max_client_size, #set_max_size, #set_min_client_size, #set_min_size, #set_name, #set_next_handler, #set_own_background_colour, #set_own_font, #set_own_foreground_colour, #set_position, #set_previous_handler, #set_scroll_pos, #set_scrollbar, #set_size, #set_size_hints, #set_sizer, #set_sizer_and_fit, #set_theme_enabled, #set_tool_tip, #set_transparent, #set_validator, #set_virtual_size, #set_window_style, #set_window_variant, #should_inherit_colours, #show, #show_with_effect, #switch_sizer, #thaw, #to_dip, to_dip, #to_phys, to_phys, #toggle_window_style, #transfer_data_from_window, #transfer_data_to_window, #unregister_hot_key, unreserve_control_id, #unset_tool_tip, #update, #update_window_ui, #use_background_colour, #use_bg_col, #use_foreground_colour, #validate, #warp_pointer, #window_to_client_size

Methods inherited from EvtHandler

add_filter, #add_pending_event, #call_after, clear_filters, #connect, #delete_pending_events, #disconnect, #evt_activate, #evt_activate_app, #evt_aui_pane_activated, #evt_aui_pane_button, #evt_aui_pane_close, #evt_aui_pane_maximize, #evt_aui_pane_restore, #evt_aui_render, #evt_auinotebook_allow_dnd, #evt_auinotebook_begin_drag, #evt_auinotebook_bg_dclick, #evt_auinotebook_button, #evt_auinotebook_drag_done, #evt_auinotebook_drag_motion, #evt_auinotebook_end_drag, #evt_auinotebook_page_changed, #evt_auinotebook_page_changing, #evt_auinotebook_page_close, #evt_auinotebook_page_closed, #evt_auinotebook_tab_middle_down, #evt_auinotebook_tab_middle_up, #evt_auinotebook_tab_right_down, #evt_auinotebook_tab_right_up, #evt_auitoolbar_begin_drag, #evt_auitoolbar_middle_click, #evt_auitoolbar_overflow_click, #evt_auitoolbar_right_click, #evt_auitoolbar_tool_dropdown, #evt_button, #evt_calculate_layout, #evt_calendar, #evt_calendar_page_changed, #evt_calendar_sel_changed, #evt_calendar_week_clicked, #evt_calendar_weekday_clicked, #evt_char, #evt_char_hook, #evt_checkbox, #evt_checklistbox, #evt_child_focus, #evt_choice, #evt_choicebook_page_changed, #evt_choicebook_page_changing, #evt_close, #evt_collapsiblepane_changed, #evt_colourpicker_changed, #evt_colourpicker_current_changed, #evt_colourpicker_dialog_cancelled, #evt_combobox, #evt_combobox_closeup, #evt_combobox_dropdown, #evt_command, #evt_command_enter, #evt_command_kill_focus, #evt_command_left_click, #evt_command_left_dclick, #evt_command_range, #evt_command_right_click, #evt_command_scroll, #evt_command_scroll_bottom, #evt_command_scroll_changed, #evt_command_scroll_linedown, #evt_command_scroll_lineup, #evt_command_scroll_pagedown, #evt_command_scroll_pageup, #evt_command_scroll_thumbrelease, #evt_command_scroll_thumbtrack, #evt_command_scroll_top, #evt_command_set_focus, #evt_context_menu, #evt_date_changed, #evt_dialup_connected, #evt_dialup_disconnected, #evt_dirctrl_fileactivated, #evt_dirctrl_selectionchanged, #evt_dirpicker_changed, #evt_display_changed, #evt_dpi_changed, #evt_drop_files, #evt_end_session, #evt_enter_window, #evt_erase_background, #evt_filectrl_fileactivated, #evt_filectrl_filterchanged, #evt_filectrl_folderchanged, #evt_filectrl_selectionchanged, #evt_filepicker_changed, #evt_find, #evt_find_close, #evt_find_next, #evt_find_replace, #evt_find_replace_all, #evt_fontpicker_changed, #evt_fullscreen, #evt_gesture_pan, #evt_gesture_rotate, #evt_gesture_zoom, #evt_grid_cell_changed, #evt_grid_cell_changing, #evt_grid_cell_left_click, #evt_grid_cell_left_dclick, #evt_grid_cell_right_click, #evt_grid_cell_right_dclick, #evt_grid_cmd_col_size, #evt_grid_cmd_editor_created, #evt_grid_cmd_range_selected, #evt_grid_cmd_range_selecting, #evt_grid_cmd_row_size, #evt_grid_col_auto_size, #evt_grid_col_move, #evt_grid_col_size, #evt_grid_col_sort, #evt_grid_editor_created, #evt_grid_editor_hidden, #evt_grid_editor_shown, #evt_grid_label_left_click, #evt_grid_label_left_dclick, #evt_grid_label_right_click, #evt_grid_label_right_dclick, #evt_grid_range_selected, #evt_grid_range_selecting, #evt_grid_row_auto_size, #evt_grid_row_move, #evt_grid_row_size, #evt_grid_select_cell, #evt_grid_tabbing, #evt_header_begin_reorder, #evt_header_begin_resize, #evt_header_click, #evt_header_dclick, #evt_header_dragging_cancelled, #evt_header_end_reorder, #evt_header_end_resize, #evt_header_middle_click, #evt_header_middle_dclick, #evt_header_resizing, #evt_header_right_click, #evt_header_right_dclick, #evt_header_separator_dclick, #evt_help, #evt_help_range, #evt_hibernate, #evt_hotkey, #evt_html_cell_clicked, #evt_html_cell_hover, #evt_html_link_clicked, #evt_hyperlink, #evt_iconize, #evt_idle, #evt_init_dialog, #evt_joy_button_down, #evt_joy_button_up, #evt_joy_move, #evt_joy_zmove, #evt_joystick_events, #evt_key_down, #evt_key_up, #evt_kill_focus, #evt_leave_window, #evt_left_dclick, #evt_left_down, #evt_left_up, #evt_list_begin_drag, #evt_list_begin_label_edit, #evt_list_begin_rdrag, #evt_list_cache_hint, #evt_list_col_begin_drag, #evt_list_col_click, #evt_list_col_dragging, #evt_list_col_end_drag, #evt_list_col_right_click, #evt_list_delete_all_items, #evt_list_delete_item, #evt_list_end_label_edit, #evt_list_insert_item, #evt_list_item_activated, #evt_list_item_checked, #evt_list_item_deselected, #evt_list_item_focused, #evt_list_item_middle_click, #evt_list_item_right_click, #evt_list_item_selected, #evt_list_item_unchecked, #evt_list_key_down, #evt_listbook_page_changed, #evt_listbook_page_changing, #evt_listbox, #evt_listbox_dclick, #evt_long_press, #evt_magnify, #evt_maximize, #evt_media_finished, #evt_media_loaded, #evt_media_pause, #evt_media_play, #evt_media_statechanged, #evt_media_stop, #evt_menu, #evt_menu_close, #evt_menu_highlight, #evt_menu_highlight_all, #evt_menu_open, #evt_menu_range, #evt_middle_dclick, #evt_middle_down, #evt_middle_up, #evt_motion, #evt_mouse_aux1_dclick, #evt_mouse_aux1_down, #evt_mouse_aux1_up, #evt_mouse_aux2_dclick, #evt_mouse_aux2_down, #evt_mouse_aux2_up, #evt_mouse_capture_changed, #evt_mouse_capture_lost, #evt_mouse_events, #evt_mousewheel, #evt_move, #evt_move_end, #evt_move_start, #evt_moving, #evt_navigation_key, #evt_notebook_page_changed, #evt_notebook_page_changing, #evt_paint, #evt_pg_changed, #evt_pg_changing, #evt_pg_col_begin_drag, #evt_pg_col_dragging, #evt_pg_col_end_drag, #evt_pg_double_click, #evt_pg_highlighted, #evt_pg_item_collapsed, #evt_pg_item_expanded, #evt_pg_label_edit_begin, #evt_pg_label_edit_ending, #evt_pg_page_changed, #evt_pg_right_click, #evt_pg_selected, #evt_press_and_tap, #evt_query_end_session, #evt_query_layout_info, #evt_radiobox, #evt_radiobutton, #evt_ribbonbar_help_click, #evt_ribbonbar_page_changed, #evt_ribbonbar_page_changing, #evt_ribbonbar_tab_left_dclick, #evt_ribbonbar_tab_middle_down, #evt_ribbonbar_tab_middle_up, #evt_ribbonbar_tab_right_down, #evt_ribbonbar_tab_right_up, #evt_ribbonbar_toggled, #evt_ribbonbuttonbar_clicked, #evt_ribbonbuttonbar_dropdown_clicked, #evt_ribbongallery_clicked, #evt_ribbongallery_hover_changed, #evt_ribbongallery_selected, #evt_ribbonpanel_extbutton_activated, #evt_ribbontoolbar_clicked, #evt_ribbontoolbar_dropdown_clicked, #evt_richtext_buffer_reset, #evt_richtext_character, #evt_richtext_consuming_character, #evt_richtext_content_deleted, #evt_richtext_content_inserted, #evt_richtext_delete, #evt_richtext_focus_object_changed, #evt_richtext_left_click, #evt_richtext_left_dclick, #evt_richtext_middle_click, #evt_richtext_properties_changed, #evt_richtext_return, #evt_richtext_right_click, #evt_richtext_selection_changed, #evt_richtext_style_changed, #evt_richtext_stylesheet_changed, #evt_richtext_stylesheet_replaced, #evt_richtext_stylesheet_replacing, #evt_right_dclick, #evt_right_down, #evt_right_up, #evt_sash_dragged, #evt_sash_dragged_range, #evt_scroll, #evt_scroll_bottom, #evt_scroll_changed, #evt_scroll_command, #evt_scroll_linedown, #evt_scroll_lineup, #evt_scroll_pagedown, #evt_scroll_pageup, #evt_scroll_thumbrelease, #evt_scroll_thumbtrack, #evt_scroll_top, #evt_scrollbar, #evt_scrollwin, #evt_scrollwin_bottom, #evt_scrollwin_linedown, #evt_scrollwin_lineup, #evt_scrollwin_pagedown, #evt_scrollwin_pageup, #evt_scrollwin_thumbrelease, #evt_scrollwin_thumbtrack, #evt_scrollwin_top, #evt_search, #evt_search_cancel, #evt_set_cursor, #evt_set_focus, #evt_show, #evt_size, #evt_slider, #evt_spin, #evt_spin_down, #evt_spin_up, #evt_spinctrl, #evt_spinctrldouble, #evt_splitter_dclick, #evt_splitter_sash_pos_changed, #evt_splitter_sash_pos_changing, #evt_splitter_sash_pos_resize, #evt_splitter_unsplit, #evt_stc_autocomp_cancelled, #evt_stc_autocomp_char_deleted, #evt_stc_autocomp_completed, #evt_stc_autocomp_selection, #evt_stc_autocomp_selection_change, #evt_stc_calltip_click, #evt_stc_change, #evt_stc_charadded, #evt_stc_clipboard_copy, #evt_stc_clipboard_paste, #evt_stc_do_drop, #evt_stc_doubleclick, #evt_stc_drag_over, #evt_stc_dwellend, #evt_stc_dwellstart, #evt_stc_hotspot_click, #evt_stc_hotspot_dclick, #evt_stc_hotspot_release_click, #evt_stc_indicator_click, #evt_stc_indicator_release, #evt_stc_macrorecord, #evt_stc_margin_right_click, #evt_stc_marginclick, #evt_stc_modified, #evt_stc_needshown, #evt_stc_painted, #evt_stc_romodifyattempt, #evt_stc_savepointleft, #evt_stc_savepointreached, #evt_stc_start_drag, #evt_stc_styleneeded, #evt_stc_updateui, #evt_stc_userlistselection, #evt_stc_zoom, #evt_sys_colour_changed, #evt_taskbar_click, #evt_taskbar_left_dclick, #evt_taskbar_left_down, #evt_taskbar_left_up, #evt_taskbar_move, #evt_taskbar_right_dclick, #evt_taskbar_right_down, #evt_taskbar_right_up, #evt_text, #evt_text_copy, #evt_text_cut, #evt_text_enter, #evt_text_maxlen, #evt_text_paste, #evt_text_url, #evt_time_changed, #evt_timer, #evt_togglebutton, #evt_tool, #evt_tool_dropdown, #evt_tool_enter, #evt_tool_range, #evt_tool_rclicked, #evt_tool_rclicked_range, #evt_toolbook_page_changed, #evt_toolbook_page_changing, #evt_tree_begin_drag, #evt_tree_begin_label_edit, #evt_tree_begin_rdrag, #evt_tree_delete_item, #evt_tree_end_drag, #evt_tree_end_label_edit, #evt_tree_get_info, #evt_tree_item_activated, #evt_tree_item_collapsed, #evt_tree_item_collapsing, #evt_tree_item_expanded, #evt_tree_item_expanding, #evt_tree_item_gettooltip, #evt_tree_item_menu, #evt_tree_item_middle_click, #evt_tree_item_right_click, #evt_tree_key_down, #evt_tree_sel_changed, #evt_tree_sel_changing, #evt_tree_set_info, #evt_tree_state_image_click, #evt_treebook_node_collapsed, #evt_treebook_node_expanded, #evt_treebook_page_changed, #evt_treebook_page_changing, #evt_two_finger_tap, #evt_update_ui, #evt_update_ui_range, #evt_window_create, #evt_window_destroy, #evt_wizard_before_page_changed, #evt_wizard_cancel, #evt_wizard_finished, #evt_wizard_help, #evt_wizard_page_changed, #evt_wizard_page_changing, #evt_wizard_page_shown, #get_client_object, #get_evt_handler_enabled, #get_next_handler, #get_previous_handler, #is_unlinked, #process_event, #process_event_locally, #process_pending_events, #queue_event, register_class, remove_filter, #safely_process_event, #set_client_object, #set_evt_handler_enabled, #set_next_handler, #set_previous_handler, #try_after, #try_before, #unlink

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::ListCtrl #initialize(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::LC_ICON, validator = Wx::DEFAULT_VALIDATOR, name = Wx::LIST_CTRL_NAME_STR) ⇒ Wx::ListCtrl

Returns a new instance of ListCtrl.

Overloads:

  • #initializeWx::ListCtrl

    Default constructor.

  • #initialize(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::LC_ICON, validator = Wx::DEFAULT_VALIDATOR, name = Wx::LIST_CTRL_NAME_STR) ⇒ Wx::ListCtrl

    Constructor, creating and showing a list control.

    Parameters:

    • parent (Wx::Window)

      Parent window. Must not be NULL.

    • id (Integer)

      Window identifier. The value StandardID::ID_ANY indicates a default value.

    • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)

      Window position. If DEFAULT_POSITION is specified then a default position is chosen.

    • size (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)

      Window size. If DEFAULT_SIZE is specified then the window is sized appropriately.

    • style (Integer) (defaults to: Wx::LC_ICON)

      Window style. See Wx::ListCtrl.

    • validator (Wx::Validator) (defaults to: Wx::DEFAULT_VALIDATOR)

      Window validator.

    • name (String) (defaults to: Wx::LIST_CTRL_NAME_STR)

      Window name.

    See Also:



479
# File 'lib/wx/doc/gen/list_ctrl.rb', line 479

def initialize(*args) end

Instance Method Details

#append_column(heading, format = Wx::ListColumnFormat::LIST_FORMAT_LEFT, width = -1)) ⇒ Integer

Adds a new column to the list control in report view mode.

This is just a convenient wrapper for #insert_column which adds the new column after all the existing ones without having to specify its position explicitly.

Parameters:

  • heading (String)
  • format (Wx::ListColumnFormat) (defaults to: Wx::ListColumnFormat::LIST_FORMAT_LEFT)
  • width (Integer) (defaults to: -1))

Returns:

  • (Integer)


488
# File 'lib/wx/doc/gen/list_ctrl.rb', line 488

def append_column(heading, format=Wx::ListColumnFormat::LIST_FORMAT_LEFT, width=-1) end

#arrange(flag = Wx::LIST_ALIGN_DEFAULT) ⇒ Boolean

Arranges the items in icon or small icon view.

This only has effect on Win32. flag is one of:

Parameters:

  • flag (Integer) (defaults to: Wx::LIST_ALIGN_DEFAULT)

Returns:

  • (Boolean)


500
# File 'lib/wx/doc/gen/list_ctrl.rb', line 500

def arrange(flag=Wx::LIST_ALIGN_DEFAULT) end

#check_item(item, check) ⇒ void

This method returns an undefined value.

Check or uncheck a Wx::ListItem in a control using checkboxes.

This method only works if checkboxes support had been successfully enabled using #enable_check_boxes. For a control with Wx::LC_VIRTUAL style, this will only generate the EVT_LIST_ITEM_CHECKED and EVT_LIST_ITEM_UNCHECKED events. See #on_get_item_is_checked for information on how to update the checkbox state.

Parameters:

  • item (Integer)

    Item (zero-based) index.

  • check (Boolean)

    If true, check the item, otherwise uncheck.



1236
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1236

def check_item(item, check) end

#clear_allvoid

This method returns an undefined value.

Deletes all items and all columns.

Note:

This sends an event of type EVT_LIST_DELETE_ALL_ITEMS under all platforms.



510
# File 'lib/wx/doc/gen/list_ctrl.rb', line 510

def clear_all; end

#create(parent, id, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::LC_ICON, validator = Wx::DEFAULT_VALIDATOR, name = Wx::LIST_CTRL_NAME_STR) ⇒ Boolean

Creates the list control.

See list_ctrl for further details.

Parameters:

  • parent (Wx::Window)
  • id (Integer)
  • pos (Array(Integer, Integer), Wx::Point) (defaults to: Wx::DEFAULT_POSITION)
  • size (Array(Integer, Integer), Wx::Size) (defaults to: Wx::DEFAULT_SIZE)
  • style (Integer) (defaults to: Wx::LC_ICON)
  • validator (Wx::Validator) (defaults to: Wx::DEFAULT_VALIDATOR)
  • name (String) (defaults to: Wx::LIST_CTRL_NAME_STR)

Returns:

  • (Boolean)


523
# File 'lib/wx/doc/gen/list_ctrl.rb', line 523

def create(parent, id, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::LC_ICON, validator=Wx::DEFAULT_VALIDATOR, name=Wx::LIST_CTRL_NAME_STR) end

#delete_all_columnsBoolean

Delete all columns in the list control.

true if all columns were successfully deleted, false otherwise.

Returns:

  • (Boolean)


529
# File 'lib/wx/doc/gen/list_ctrl.rb', line 529

def delete_all_columns; end

#delete_all_itemsBoolean

Deletes all items in the list control.

This function does not send the EVT_LIST_DELETE_ITEM event because deleting many items from the control would be too slow then (unlike #delete_item) but it does send the special EVT_LIST_DELETE_ALL_ITEMS event if the control was not empty. If it was already empty, nothing is done and no event is sent. true if the items were successfully deleted or if the control was already empty, false if an error occurred while deleting the items.

Returns:

  • (Boolean)


536
# File 'lib/wx/doc/gen/list_ctrl.rb', line 536

def delete_all_items; end

#delete_column(col) ⇒ Boolean

Deletes a column.

Parameters:

  • col (Integer)

Returns:

  • (Boolean)


541
# File 'lib/wx/doc/gen/list_ctrl.rb', line 541

def delete_column(col) end

#delete_item(item) ⇒ Boolean

Deletes the specified item.

This function sends the EVT_LIST_DELETE_ITEM event for the item being deleted.

Parameters:

  • item (Integer)

Returns:

  • (Boolean)

See Also:



549
# File 'lib/wx/doc/gen/list_ctrl.rb', line 549

def delete_item(item) end

#each {|item| ... } ⇒ ::Object

Iterates all items in the list control passing each item (id) to the given block.

Yield Parameters:

  • item (Integer)

Returns:

  • (::Object)

    result of last block iteration



17
# File 'lib/wx/doc/list_ctrl.rb', line 17

def each(&block) end

#each_selected {|item| ... } ⇒ ::Object

Iterates all selected items in the list control (like #get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)) passing each item (id) to the given block.

Yield Parameters:

  • item (Integer)

Returns:

  • (::Object)

    result of last block iteration



23
# File 'lib/wx/doc/list_ctrl.rb', line 23

def each_selected(&block) end

#enable_alternate_row_colours(enable = true) ⇒ void

This method returns an undefined value.

Enable alternating row background colours (also called zebra striping).

This method can only be called for the control in virtual report mode, i.e. having Wx::LC_REPORT and Wx::LC_VIRTUAL styles. When enabling alternating colours, the appropriate colour for the even rows is chosen automatically depending on the default foreground and background colours which are used for the odd rows.

Parameters:

  • enable (Boolean) (defaults to: true)

    If true, enable alternating row background colours, i.e. different colours for the odd and even rows. If false, disable this feature and use the same background colour for all rows.

See Also:



558
# File 'lib/wx/doc/gen/list_ctrl.rb', line 558

def enable_alternate_row_colours(enable=true) end

#enable_bell_on_no_match(on = true) ⇒ void

This method returns an undefined value.

Enable or disable a beep if there is no match for the currently entered text when searching for the item from keyboard.

The default is to not beep in this case except in WXMSW where the beep is always generated by the native control and cannot be disabled, i.e. calls to this function do nothing there.

Parameters:

  • on (Boolean) (defaults to: true)


565
# File 'lib/wx/doc/gen/list_ctrl.rb', line 565

def enable_bell_on_no_match(on=true) end

#enable_check_boxes(enable = true) ⇒ Boolean

Enable or disable checkboxes for list items.

true if checkboxes are supported, false otherwise.

In a list control with Wx::LC_VIRTUAL style you have to keep track of the checkbox state. When a checkbox is clicked (EVT_LIST_ITEM_CHECKED or EVT_LIST_ITEM_UNCHECKED) you have to update the state and refresh the item yourself.

Parameters:

  • enable (Boolean) (defaults to: true)

    If true, enable checkboxes, otherwise disable checkboxes.

Returns:

  • (Boolean)

See Also:



1218
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1218

def enable_check_boxes(enable=true) end

#end_edit_label(cancel) ⇒ Boolean

Finish editing the label.

This method allows one to programmatically end editing a list control item in place. Usually it will only be called when editing is in progress, i.e. if #get_edit_control returns non-NULL. In particular, do not call it from EVT_LIST_BEGIN_LABEL_EDIT handler as the edit control is not yet fully created by then, just veto the event in this handler instead to prevent the editing from even starting. Notice that calling this method will result in EVT_LIST_END_LABEL_EDIT event being generated. Currently only implemented in WXMSW.

true if item editing was finished or false if no item as being edited.

Parameters:

  • cancel (Boolean)

    If true, discard the changes made by user, as if Escape key was pressed. Otherwise, accept the changes as if Return was pressed.

Returns:

  • (Boolean)


576
# File 'lib/wx/doc/gen/list_ctrl.rb', line 576

def end_edit_label(cancel) end

#ensure_visible(item) ⇒ Boolean

Ensures this item is visible.

Parameters:

  • item (Integer)

Returns:

  • (Boolean)


581
# File 'lib/wx/doc/gen/list_ctrl.rb', line 581

def ensure_visible(item) end

#extend_rules_and_alternate_colour(extend = true) ⇒ void

This method returns an undefined value.

Extend rules and alternate rows background to the entire client area.

By default, the rules (when enabled with Wx::LC_HRULES and Wx::LC_VRULES) and alternate row background (when #enable_alternate_row_colours was called) are only shown in the part of the control occupied by the items, which can be smaller than the entire window if there are few items in the control. Calling this function extends the display of the rules and alternate background rows to the entire client area. Similarly to #enable_alternate_row_colours, this method can only be used with controls having Wx::LC_REPORT and Wx::LC_VIRTUAL styles. Note that this method is currently not implemented in the native MSW version and does nothing there.

Parameters:

  • extend (Boolean) (defaults to: true)

    if true, draws horizontal rules and vertical rules on empty rows and uses the colour parameter to paint the background of alternate rows when those rows are blank, empty, with no data.



1246
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1246

def extend_rules_and_alternate_colour(extend=true) end

#find_item(start, str, partial = false) ⇒ Integer #find_item(start, data) ⇒ Integer #find_item(start, pt, direction) ⇒ Integer

Overloads:

  • #find_item(start, str, partial = false) ⇒ Integer

    Find an item whose label matches this string, starting from start or the beginning if start is -1.

    The string comparison is case insensitive. If partial is true then this method will look for items which begin with str. The next matching item if any or -1 (NOT_FOUND) otherwise.

    Parameters:

    • start (Integer)
    • str (String)
    • partial (Boolean) (defaults to: false)

    Returns:

    • (Integer)
  • #find_item(start, data) ⇒ Integer

    Find an item whose data matches this data, starting from start or the beginning if ‘start’ is -1.

    The next matching item if any or -1 (NOT_FOUND) otherwise.

    Parameters:

    • start (Integer)
    • data (Integer)

    Returns:

    • (Integer)
  • #find_item(start, pt, direction) ⇒ Integer

    Find an item nearest this position in the specified direction, starting from start or the beginning if start is -1.

    The next matching item if any or -1 (NOT_FOUND) otherwise.

    Parameters:

    • start (Integer)
    • pt (Array(Integer, Integer), Wx::Point)
    • direction (Integer)

    Returns:

    • (Integer)


608
# File 'lib/wx/doc/gen/list_ctrl.rb', line 608

def find_item(*args) end

#get_alternate_row_colourWx::Colour Also known as: alternate_row_colour

Get the alternative row background colour.

Returns:

See Also:



871
# File 'lib/wx/doc/gen/list_ctrl.rb', line 871

def get_alternate_row_colour; end

#get_column(col, item) ⇒ Boolean Also known as: column

Gets information about this column.

See #set_item for more information.

Parameters:

Returns:

  • (Boolean)


616
# File 'lib/wx/doc/gen/list_ctrl.rb', line 616

def get_column(col, item) end

#get_column_countInteger Also known as: column_count

Returns the number of columns.

The control can have multiple columns only in Wx::LC_REPORT mode. In Wx::LC_LIST mode this function returns 1, as a list is still considered to have a (single) column. In Wx::LC_SMALL_ICON and Wx::LC_ICON modes, it returns 0 as there are no columns at all.

Returns:

  • (Integer)


623
# File 'lib/wx/doc/gen/list_ctrl.rb', line 623

def get_column_count; end

#get_column_index_from_order(pos) ⇒ Integer Also known as: column_index_from_order

Gets the column index from its position in visual order.

After calling #set_columns_order, the index returned by this function corresponds to the value of the element number pos in the array returned by #get_columns_order.

Note:

This function makes sense for report view only and currently is only implemented in the WXMSW port. Use HAS_LISTCTRL_COLUMN_ORDER to guard uses of this function so that they will start working under the other platforms when support for the column reordering is added there.

Parameters:

  • pos (Integer)

Returns:

  • (Integer)

See Also:

Requires:

  • HAS_LISTCTRL_COLUMN_ORDER


639
# File 'lib/wx/doc/gen/list_ctrl.rb', line 639

def get_column_index_from_order(pos) end

#get_column_order(col) ⇒ Integer Also known as: column_order

Gets the column visual order position.

This function returns the index of the column which appears at the given visual position, e.g. calling it with col equal to 0 returns the index of the first shown column.

Note:

This function makes sense for report view only and currently is only implemented in the WXMSW port. Use HAS_LISTCTRL_COLUMN_ORDER to guard uses of this function so that they will start working under the other platforms when support for the column reordering is added there.

Parameters:

  • col (Integer)

Returns:

  • (Integer)

See Also:

Requires:

  • HAS_LISTCTRL_COLUMN_ORDER


656
# File 'lib/wx/doc/gen/list_ctrl.rb', line 656

def get_column_order(col) end

#get_column_width(col) ⇒ Integer Also known as: column_width

Gets the column width (report view only).

Parameters:

  • col (Integer)

Returns:

  • (Integer)


662
# File 'lib/wx/doc/gen/list_ctrl.rb', line 662

def get_column_width(col) end

#get_columns_orderArray<Integer> Also known as: columns_order

Returns the array containing the orders of all columns.

On error, an empty array is returned.

Note:

This function makes sense for report view only and currently is only implemented in the WXMSW port. Use HAS_LISTCTRL_COLUMN_ORDER to guard uses of this function so that they will start working under the other platforms when support for the column reordering is added there.

Returns:

  • (Array<Integer>)

See Also:

Requires:

  • HAS_LISTCTRL_COLUMN_ORDER


678
# File 'lib/wx/doc/gen/list_ctrl.rb', line 678

def get_columns_order; end

#get_count_per_pageInteger Also known as: count_per_page

Gets the number of items that can fit vertically in the visible area of the list control (list or report view) or the total number of items in the list control (icon or small icon view).

Returns:

  • (Integer)


683
# File 'lib/wx/doc/gen/list_ctrl.rb', line 683

def get_count_per_page; end

#get_edit_controlWx::TextCtrl Also known as: edit_control

Returns the edit control being currently used to edit a label.

Returns NULL if no label is being edited.

Note:

It is currently only implemented for WXMSW and the generic version, not for the native macOS version.

Returns:



696
# File 'lib/wx/doc/gen/list_ctrl.rb', line 696

def get_edit_control; end

#get_image_list(which) ⇒ Wx::ImageList Also known as: image_list

Returns the specified image list.

which may be one of:

Parameters:

  • which (Integer)

Returns:



708
# File 'lib/wx/doc/gen/list_ctrl.rb', line 708

def get_image_list(which) end

#get_item_background_colour(item) ⇒ Wx::Colour Also known as: item_background_colour

Returns the colour for this item.

If the item has no specific colour, returns an invalid colour (and not the default background colour of the control itself).

Parameters:

  • item (Integer)

Returns:

See Also:



717
# File 'lib/wx/doc/gen/list_ctrl.rb', line 717

def get_item_background_colour(item) end

#get_item_countInteger Also known as: item_count

Returns the number of items in the list control.

Returns:

  • (Integer)


722
# File 'lib/wx/doc/gen/list_ctrl.rb', line 722

def get_item_count; end

#get_item_font(item) ⇒ Wx::Font Also known as: item_font

Returns the item’s font.

Parameters:

  • item (Integer)

Returns:



728
# File 'lib/wx/doc/gen/list_ctrl.rb', line 728

def get_item_font(item) end

#get_item_position(item, pos) ⇒ Boolean Also known as: item_position

Returns the position of the item, in icon or small icon view.

Parameters:

  • item (Integer)
  • pos (Array(Integer, Integer), Wx::Point)

Returns:

  • (Boolean)


735
# File 'lib/wx/doc/gen/list_ctrl.rb', line 735

def get_item_position(item, pos) end

#get_item_rect(item, code = Wx::LIST_RECT_BOUNDS) ⇒ Array(Boolean,Wx::Rect) Also known as: item_rect

Returns the rectangle representing the item’s size and position, in physical coordinates.

code is one of Wx::LIST_RECT_BOUNDS, Wx::LIST_RECT_ICON, Wx::LIST_RECT_LABEL.

Parameters:

  • item (Integer)
  • code (Integer) (defaults to: Wx::LIST_RECT_BOUNDS)

Returns:



744
# File 'lib/wx/doc/gen/list_ctrl.rb', line 744

def get_item_rect(item, code=Wx::LIST_RECT_BOUNDS) end

#get_item_spacingWx::Size Also known as: item_spacing

Retrieves the spacing between icons in pixels: horizontal spacing is returned as x component of the Size object and the vertical spacing as its y component.

Returns:



749
# File 'lib/wx/doc/gen/list_ctrl.rb', line 749

def get_item_spacing; end

#get_item_state(item, stateMask) ⇒ Integer Also known as: item_state

Gets the item state.

For a list of state flags, see #set_item. The stateMask indicates which state flags are of interest.

Parameters:

  • item (Integer)
  • stateMask (Integer)

Returns:

  • (Integer)


758
# File 'lib/wx/doc/gen/list_ctrl.rb', line 758

def get_item_state(item, stateMask) end

#get_item_text(item, col = 0) ⇒ String Also known as: item_text

Gets the item text for this item.

Parameters:

  • item (Integer)

    Item (zero-based) index.

  • col (Integer) (defaults to: 0)

    Item column (zero-based) index. Column 0 is the default. This parameter is new in wxWidgets 2.9.1.

Returns:

  • (String)


765
# File 'lib/wx/doc/gen/list_ctrl.rb', line 765

def get_item_text(item, col=0) end

#get_item_text_colour(item) ⇒ Wx::Colour Also known as: item_text_colour

Returns the colour for this item.

If the item has no specific colour, returns an invalid colour (and not the default foreground colour of the control itself as this wouldn’t allow distinguishing between items having the same colour as the current control foreground and items with default colour which, hence, have always the same colour as the control).

Parameters:

  • item (Integer)

Returns:



773
# File 'lib/wx/doc/gen/list_ctrl.rb', line 773

def get_item_text_colour(item) end

#get_next_item(item, geometry = Wx::LIST_NEXT_ALL, state = Wx::LIST_STATE_DONTCARE) ⇒ Integer Also known as: next_item

Searches for an item with the given geometry or state, starting from item but excluding the item itself.

If item is -1, the first item that matches the specified flags will be returned. Returns the first item with given state following item or -1 if no such item found. This function may be used to find all selected items in the control like this:

item = -1
  while (item = list_ctrl.get_next_item(item, Wx::LIST_NEXT_ALL, Wx::LIST_STATE_SELECTED)) != -1
    # item is selected - do whatever is needed with it
    Wx.log_message("Item #{item} is selected.")
  end

  # alternatively in wxRuby you could do
  list_ctrl.each_selected do |item|
    Wx.log_message("Item #{item} is selected.")
  end

geometry can be one of:

Note:

this parameter is only supported by WXMSW currently and ignored on other platforms.

state can be a bitlist of the following:

Parameters:

  • item (Integer)
  • geometry (Integer) (defaults to: Wx::LIST_NEXT_ALL)
  • state (Integer) (defaults to: Wx::LIST_STATE_DONTCARE)

Returns:

  • (Integer)


818
# File 'lib/wx/doc/gen/list_ctrl.rb', line 818

def get_next_item(item, geometry=Wx::LIST_NEXT_ALL, state=Wx::LIST_STATE_DONTCARE) end

#get_selected_item_countInteger Also known as: selected_item_count

Returns the number of selected items in the list control.

Returns:

  • (Integer)


823
# File 'lib/wx/doc/gen/list_ctrl.rb', line 823

def get_selected_item_count; end

#get_selectionsArray<Integer>

Returns array of selected items.

Returns:

  • (Array<Integer>)

    selected items



27
# File 'lib/wx/doc/list_ctrl.rb', line 27

def get_selections; end

#get_sort_indicatorInteger Also known as: sort_indicator

Returns the column that shows the sort indicator.

Can return -1 if there is no sort indicator currently shown.

Returns:

  • (Integer)


1271
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1271

def get_sort_indicator; end

#get_sub_item_rect(item, subItem, code = Wx::LIST_RECT_BOUNDS) ⇒ Array(Boolean,Wx::Rect) Also known as: sub_item_rect

Returns the rectangle representing the size and position, in physical coordinates, of the given subitem, i.e.

the part of the row item in the column subItem. This method is only meaningful when the Wx::ListCtrl is in the report mode. If subItem parameter is equal to the special value Wx::LIST_GETSUBITEMRECT_WHOLEITEM the return value is the same as for #get_item_rect. code can be one of Wx::LIST_RECT_BOUNDS, Wx::LIST_RECT_ICON or Wx::LIST_RECT_LABEL. Note that using Wx::LIST_RECT_ICON with any sub-item but the first one isn’t very useful as only the first sub-item can have an icon in Wx::ListCtrl. In this case, i.e. for subItem > 0, this function simply returns an empty rectangle in rect.

Parameters:

  • item (Integer)
  • subItem (Integer)
  • code (Integer) (defaults to: Wx::LIST_RECT_BOUNDS)

Returns:



836
# File 'lib/wx/doc/gen/list_ctrl.rb', line 836

def get_sub_item_rect(item, subItem, code=Wx::LIST_RECT_BOUNDS) end

#get_text_colourWx::Colour Also known as: text_colour

Gets the text colour of the list control.

Returns:



841
# File 'lib/wx/doc/gen/list_ctrl.rb', line 841

def get_text_colour; end

#get_top_itemInteger Also known as: top_item

Gets the index of the topmost visible item when in list or report view.

Returns:

  • (Integer)


846
# File 'lib/wx/doc/gen/list_ctrl.rb', line 846

def get_top_item; end

#get_updated_ascending_sort_indicator(col) ⇒ Boolean Also known as: updated_ascending_sort_indicator

Returns the new value to use for sort indicator after clicking a column.

This helper function can be useful in the EVT_LIST_COL_CLICK handler when it updates the sort indicator after the user clicked on a column. For example:

class MyListCtrl

    def on_col_click(event)
      col = event.column
      if col == -1
         return # clicked outside any column.
  
      ascending = get_updated_ascending_sort_indicator(col)
      sort_items(ascending) { |itm1_data, itm2_data, data| ... }
      show_sort_indicator(col, ascending)
    end

  end

Parameters:

  • col (Integer)

Returns:

  • (Boolean)


1295
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1295

def get_updated_ascending_sort_indicator(col) end

#get_view_rectWx::Rect Also known as: view_rect

Returns the rectangle taken by all items in the control.

In other words, if the controls client size were equal to the size of this rectangle, no scrollbars would be needed and no free space would be left. Note that this function only works in the icon and small icon views, not in list or report views (this is a limitation of the native Win32 control).

Returns:



854
# File 'lib/wx/doc/gen/list_ctrl.rb', line 854

def get_view_rect; end

#has_check_boxesBoolean Also known as: has_check_boxes?

Returns true if checkboxes are enabled for list items.

Returns:

  • (Boolean)

See Also:



1207
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1207

def has_check_boxes; end

#hit_test(point) ⇒ Array(Integer,Integer)

Determines which item (if any) is at the specified point, giving details in flags.

Returns index of the item or NOT_FOUND if no item is at the specified point. flags will be a combination of the following flags:

If ptrSubItem is not NULL and the Wx::ListCtrl is in the report mode the subitem (or column) number will also be provided. This feature is only available in version 2.7.0 or higher and is currently only implemented under WXMSW and requires at least comctl32.dll of version 4.70 on the host system or the value stored in ptrSubItem will be always -1. To compile this feature into wxWidgets library you need to have access to commctrl.h of version 4.70 that is provided by Microsoft.

Parameters:

Returns:

  • (Array(Integer,Integer))


892
# File 'lib/wx/doc/gen/list_ctrl.rb', line 892

def hit_test(point) end

#in_report_viewBoolean

Returns true if the control is currently using Wx::LC_REPORT style.

Returns:

  • (Boolean)


896
# File 'lib/wx/doc/gen/list_ctrl.rb', line 896

def in_report_view; end

#insert_column(col, info) ⇒ Integer #insert_column(col, heading, format = Wx::ListColumnFormat::LIST_FORMAT_LEFT, width = Wx::LIST_AUTOSIZE) ⇒ Integer

Overloads:

  • #insert_column(col, info) ⇒ Integer

    For report view mode (only), inserts a column.

    For more details, see #set_item. Also see InsertColumn(long, const wxString&, int, int) overload for a usually more convenient alternative to this method and the description of how the item width is interpreted by this method.

    Parameters:

    Returns:

    • (Integer)
  • #insert_column(col, heading, format = Wx::ListColumnFormat::LIST_FORMAT_LEFT, width = Wx::LIST_AUTOSIZE) ⇒ Integer

    For report view mode (only), inserts a column.

    Insert a new column in the list control in report view mode at the given position specifying its most common attributes. Notice that to set the image for the column you need to use InsertColumn(long, const wxListItem&) overload and specify Wx::LIST_MASK_IMAGE in the item mask.

    The index of the inserted column or -1 if adding it failed.

    Parameters:

    • col (Integer)

      The index where the column should be inserted. Valid indices are from 0 up to #get_column_count inclusive and the latter can be used to append the new column after the last existing one.

    • heading (String)

      The string specifying the column heading.

    • format (Integer) (defaults to: Wx::ListColumnFormat::LIST_FORMAT_LEFT)

      The flags specifying the control heading text alignment.

    • width (Integer) (defaults to: Wx::LIST_AUTOSIZE)

      If positive, the width of the column in pixels. Otherwise it can be Wx::LIST_AUTOSIZE to choose the default size for the column or Wx::LIST_AUTOSIZE_USEHEADER to fit the column width to heading or to extend to fill all the remaining space for the last column. Notice that in case of Wx::LIST_AUTOSIZE fixed width is used as there are no items in this column to use for determining its best size yet. If you want to fit the column to its contents, use #set_column_width after adding the items with values in this column.

    Returns:

    • (Integer)


917
# File 'lib/wx/doc/gen/list_ctrl.rb', line 917

def insert_column(*args) end

#insert_item(info) ⇒ Integer #insert_item(index, label) ⇒ Integer #insert_item(index, imageIndex) ⇒ Integer #insert_item(index, label, imageIndex) ⇒ Integer

Overloads:

  • #insert_item(info) ⇒ Integer

    Inserts an item, returning the index of the new item if successful, -1 otherwise.

    Parameters:

    Returns:

    • (Integer)
  • #insert_item(index, label) ⇒ Integer

    Insert a string item.

    Parameters:

    • index (Integer)

      Index of the new item, supplied by the application

    • label (String)

      String label

    Returns:

    • (Integer)
  • #insert_item(index, imageIndex) ⇒ Integer

    Insert an image item.

    Parameters:

    • index (Integer)

      Index of the new item, supplied by the application

    • imageIndex (Integer)

      Index into the image list associated with this control and view style

    Returns:

    • (Integer)
  • #insert_item(index, label, imageIndex) ⇒ Integer

    Insert an image/string item.

    Parameters:

    • index (Integer)

      Index of the new item, supplied by the application

    • label (String)

      String label

    • imageIndex (Integer)

      Index into the image list associated with this control and view style

    Returns:

    • (Integer)


939
# File 'lib/wx/doc/gen/list_ctrl.rb', line 939

def insert_item(*args) end

#is_ascending_sort_indicatorBoolean Also known as: ascending_sort_indicator?

Returns true if the sort indicator direction is ascending, false when the direction is descending.

Returns:

  • (Boolean)


1300
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1300

def is_ascending_sort_indicator; end

#is_emptyBoolean Also known as: empty?

Returns true if the control doesn’t currently contain any items.

Note that the control with some columns is still considered to be empty if it has no rows.

Returns:

  • (Boolean)


945
# File 'lib/wx/doc/gen/list_ctrl.rb', line 945

def is_empty; end

#is_item_checked(item) ⇒ Boolean Also known as: item_checked?

Return true if the checkbox for the given Wx::ListItem is checked.

Always returns false if checkboxes support hadn’t been enabled. For a control with Wx::LC_VIRTUAL style, this uses #on_get_item_is_checked.

Parameters:

  • item (Integer)

    Item (zero-based) index.

Returns:

  • (Boolean)


1226
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1226

def is_item_checked(item) end

#is_virtualBoolean Also known as: virtual?

Returns true if the control is currently in virtual report view.

Returns:

  • (Boolean)


950
# File 'lib/wx/doc/gen/list_ctrl.rb', line 950

def is_virtual; end

#is_visible(item) ⇒ Boolean Also known as: visible?

Check if the item is visible.

An item is considered visible if at least one pixel of it is present on the screen.

Parameters:

  • item (Integer)

Returns:

  • (Boolean)


1078
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1078

def is_visible(item) end

#on_get_item_attr(item) ⇒ Wx::ItemAttr (protected)

This function may be overridden in the derived class for a control with Wx::LC_VIRTUAL style.

It should return the attribute for the specified item or NULL to use the default appearance parameters. Wx::ListCtrl will not delete the pointer or keep a reference of it. You can return the same ItemAttr pointer for every #on_get_item_attr call. The base class version always returns NULL.



1318
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1318

def on_get_item_attr(item) end

#on_get_item_column_attr(item, column) ⇒ Wx::ItemAttr (protected)

This function may be overridden in the derived class for a control with Wx::LC_VIRTUAL style.

It should return the attribute for the for the specified item and column or NULL to use the default appearance parameters. The base class version returns OnGetItemAttr(item).

Note:

Currently this function is only called under WXMSW, the other ports only support #on_get_item_attr

Parameters:

  • item (Integer)
  • column (Integer)

Returns:

See Also:



1338
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1338

def on_get_item_column_attr(item, column) end

#on_get_item_column_image(item, column) ⇒ Integer (protected)

Override this function in the derived class for a control with Wx::LC_VIRTUAL and Wx::LC_REPORT styles in order to specify the image index for the given line and column.

The base class version always calls #on_get_item_image for the first column, else it returns -1.

Parameters:

  • item (Integer)
  • column (Integer)

Returns:

  • (Integer)

See Also:



1350
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1350

def on_get_item_column_image(item, column) end

#on_get_item_image(item) ⇒ Integer (protected)

This function must be overridden in the derived class for a control with Wx::LC_VIRTUAL style using images.

If the control doesn’t use images, i.e. #set_normal_images or #set_small_images hadn’t been called, it is not necessary to override it. It should return the index of the items image in the controls image list or -1 for no image. In a control with Wx::LC_REPORT style, #on_get_item_image only gets called for the first column of each line. The base class version always returns -1.

Parameters:

  • item (Integer)

Returns:

  • (Integer)

See Also:



1363
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1363

def on_get_item_image(item) end

#on_get_item_is_checked(item) ⇒ Boolean (protected)

This function must be overridden in the derived class for a control with Wx::LC_VIRTUAL style that uses checkboxes.

It should return whether the checkbox of the specified item is checked.

Parameters:

  • item (Integer)

Returns:

  • (Boolean)

See Also:



1384
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1384

def on_get_item_is_checked(item) end

#on_get_item_text(item, column) ⇒ String (protected)

This function must be overridden in the derived class for a control with Wx::LC_VIRTUAL style.

It should return the string containing the text of the given column for the specified item.

Parameters:

  • item (Integer)
  • column (Integer)

Returns:

  • (String)

See Also:



1375
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1375

def on_get_item_text(item, column) end

#refresh_item(item) ⇒ void

This method returns an undefined value.

Redraws the given item.

This is only useful for the virtual list controls as without calling this function the displayed value of the item doesn’t change even when the underlying data does change.

Parameters:

  • item (Integer)

See Also:



959
# File 'lib/wx/doc/gen/list_ctrl.rb', line 959

def refresh_item(item) end

#refresh_items(itemFrom, itemTo) ⇒ void

This method returns an undefined value.

Redraws the items between itemFrom and itemTo.

The starting item must be less than or equal to the ending one. Just as #refresh_item this is only useful for virtual list controls.

Parameters:

  • itemFrom (Integer)
  • itemTo (Integer)


968
# File 'lib/wx/doc/gen/list_ctrl.rb', line 968

def refresh_items(itemFrom, itemTo) end

#remove_sort_indicatorvoid

This method returns an undefined value.

Remove the sort indicator from the column being used as sort key.



1265
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1265

def remove_sort_indicator; end

#scroll_list(dx, dy) ⇒ Boolean

Scrolls the list control.

If in icon, small icon or report view mode, dx specifies the number of pixels to scroll. If in list view mode, dx specifies the number of columns to scroll. dy always specifies the number of pixels to scroll vertically.

Note:

This method is currently only implemented in the Windows version.

Parameters:

  • dx (Integer)
  • dy (Integer)

Returns:

  • (Boolean)


982
# File 'lib/wx/doc/gen/list_ctrl.rb', line 982

def scroll_list(dx, dy) end

#set_alternate_row_colour(colour) ⇒ void Also known as: alternate_row_colour=

This method returns an undefined value.

Set the alternative row background colour to a specific colour.

It is recommended to call #enable_alternate_row_colours instead of using these methods as native implementations of this control might support alternating row colours but not setting the exact colour to be used for them. As #enable_alternate_row_colours, this method can only be used with controls having Wx::LC_REPORT and Wx::LC_VIRTUAL styles.

Parameters:

  • colour (Wx::Colour, String, Symbol)

    A valid alternative row background colour to enable alternating rows or invalid colour to disable them and use the same colour for all rows.



863
# File 'lib/wx/doc/gen/list_ctrl.rb', line 863

def set_alternate_row_colour(colour) end

#set_background_colour(col) ⇒ Boolean Also known as: background_colour=

Sets the background colour.

Note that the Window#get_background_colour function of Window base class can be used to retrieve the current background colour.

Note:

If alternate row colouring is enabled, then call #enable_alternate_row_colours again after changing the background colour. This will update the alternate row color to match the new background colour.

Parameters:

Returns:

  • (Boolean)


995
# File 'lib/wx/doc/gen/list_ctrl.rb', line 995

def set_background_colour(col) end

#set_column(col, item) ⇒ Boolean

Sets information about this column.

See #set_item for more information.

Parameters:

Returns:

  • (Boolean)


1004
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1004

def set_column(col, item) end

#set_column_width(col, width) ⇒ Boolean

Sets the column width.

width can be a width in pixels or Wx::LIST_AUTOSIZE (-1) or Wx::LIST_AUTOSIZE_USEHEADER (-2). Wx::LIST_AUTOSIZE will resize the column to the length of its longest item. Wx::LIST_AUTOSIZE_USEHEADER will resize the column to the length of the header (Win32) or 80 pixels (other platforms). In small or normal icon view, col must be -1, and the column width is set for all columns.

Parameters:

  • col (Integer)
  • width (Integer)

Returns:

  • (Boolean)


1015
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1015

def set_column_width(col, width) end

#set_columns_order(orders) ⇒ Boolean

Changes the order in which the columns are shown.

The orders array must have the same number elements as the number of columns and contain each position exactly once. Its n-th element contains the index of the column to be shown in n-th position, so for a control with three columns passing an array with elements 2, 0 and 1 results in the third column being displayed first, the first one next and the second one last.

Note:

This function makes sense for report view only and currently is only implemented in the WXMSW port. Use HAS_LISTCTRL_COLUMN_ORDER to guard uses of this function so that they will start working under the other platforms when support for the column reordering is added there.

Parameters:

  • orders (Array<Integer>)

Returns:

  • (Boolean)

See Also:

Requires:

  • HAS_LISTCTRL_COLUMN_ORDER


1030
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1030

def set_columns_order(orders) end

#set_header_attr(attr) ⇒ Boolean Also known as: header_attr=

Change the font and the colours used for the list control header.

This method can be used to change the appearance of the header shown by the control in report mode (unless Wx::LC_NO_HEADER style is used). Currently it is implemented only for WXMSW and does nothing in the other ports.

true if the attributes have been updated or false if this is not supported by the current platform.

Parameters:

  • attr (Wx::ItemAttr)

    The object containing the font and text and background colours to use. It may be default, i.e. not specify any custom font nor colours, to reset any previously set custom attribute.

Returns:

  • (Boolean)


1040
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1040

def set_header_attr(attr) end

#set_image_list(imageList, which) ⇒ void

This method returns an undefined value.

Sets the image list associated with the control.

Not that it is recommended to use #set_normal_images or #set_small_images instead of this function in the new code. which must be one of IMAGE_LIST_NORMAL, IMAGE_LIST_SMALL, IMAGE_LIST_STATE (support for the last one is unimplemented). This method does not take ownership of the image list, you have to delete it yourself. Note that, unlike for most of the other methods of this class, it is possible to call this function before the corresponding window is created, i.e. do it in a constructor of a class derived from Wx::ListCtrl before calling #create.

Parameters:

See Also:

  • assign_image_list


1053
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1053

def set_image_list(imageList, which) end

#set_item(info) ⇒ Boolean #set_item(index, column, label, imageId = -1) ⇒ Boolean Also known as: item=

Overloads:

  • #set_item(info) ⇒ Boolean

    Sets the data of an item.

    Using the Wx::ListItem‘s mask and state mask, you can change only selected attributes of a Wx::ListCtrl item. true if the item was successfully updated or false if the update failed for some reason (e.g. an invalid item index).

    Parameters:

    Returns:

    • (Boolean)
  • #set_item(index, column, label, imageId = -1) ⇒ Boolean

    Sets an item string field at a particular column.

    true if the item was successfully updated or false if the update failed for some reason (e.g. an invalid item index).

    Parameters:

    • index (Integer)
    • column (Integer)
    • label (String)
    • imageId (Integer) (defaults to: -1)

    Returns:

    • (Boolean)


1097
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1097

def set_item(*args) end

#set_item_background_colour(item, col) ⇒ void

This method returns an undefined value.

Sets the background colour for this item.

This function only works in report view mode. The colour can be retrieved using #get_item_background_colour.

Parameters:



1106
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1106

def set_item_background_colour(item, col) end

#set_item_column_image(item, column, image) ⇒ Boolean

Sets the image associated with the item.

In report view, you can specify the column. The image is an index into the image list associated with the list control.

Parameters:

  • item (Integer)
  • column (Integer)
  • image (Integer)

Returns:

  • (Boolean)


1115
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1115

def set_item_column_image(item, column, image) end

#set_item_count(count) ⇒ void Also known as: item_count=

This method returns an undefined value.

This method can only be used with virtual list controls.

It is used to indicate to the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as #on_get_item_text) for all items in the range from 0 to count. Notice that the control is not necessarily redrawn after this call as it may be undesirable if an item which is not visible on the screen anyhow was added to or removed from a control displaying many items, if you do need to refresh the display you can just call Window#refresh manually.

Parameters:

  • count (Integer)


1123
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1123

def set_item_count(count) end

#set_item_font(item, font) ⇒ void

This method returns an undefined value.

Sets the item’s font.

Parameters:



1130
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1130

def set_item_font(item, font) end

#set_item_image(item, image, selImage = -1)) ⇒ Boolean

Sets the unselected and selected images associated with the item.

The images are indices into the image list associated with the list control.

Parameters:

  • item (Integer)
  • image (Integer)
  • selImage (Integer) (defaults to: -1))

Returns:

  • (Boolean)


1139
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1139

def set_item_image(item, image, selImage=-1) end

#set_item_position(item, pos) ⇒ Boolean

Sets the position of the item, in icon or small icon view.

Windows only.

Parameters:

  • item (Integer)
  • pos (Array(Integer, Integer), Wx::Point)

Returns:

  • (Boolean)


1147
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1147

def set_item_position(item, pos) end

#set_item_state(item, state, stateMask) ⇒ Boolean

Sets the item state.

The stateMask is a combination of Wx::LIST_STATE_XXX constants described in Wx::ListItem documentation. For each of the bits specified in stateMask, the corresponding state is set or cleared depending on whether state argument contains the same bit or not. So to select an item you can use

list.set_item_state(item, Wx::LIST_STATE_SELECTED, Wx::LIST_STATE_SELECTED)

while to deselect it you should use

list.set_item_state(item, 0, Wx::LIST_STATE_SELECTED)

Consider using Wx::ListView if possible to avoid dealing with this error-prone and confusing method. Also notice that contrary to the usual rule that only user actions generate events, this method does generate EVT_LIST_ITEM_SELECTED event when it is used to select an item.

Parameters:

  • item (Integer)
  • state (Integer)
  • stateMask (Integer)

Returns:

  • (Boolean)


1167
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1167

def set_item_state(item, state, stateMask) end

#set_item_text(item, text) ⇒ void

This method returns an undefined value.

Sets the item text for this item.

Parameters:

  • item (Integer)
  • text (String)


1173
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1173

def set_item_text(item, text) end

#set_item_text_colour(item, col) ⇒ void

This method returns an undefined value.

Sets the colour for this item.

This function only works in report view. The colour can be retrieved using #get_item_text_colour.

Parameters:



1181
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1181

def set_item_text_colour(item, col) end

#set_normal_images(images) ⇒ void Also known as: normal_images=

This method returns an undefined value.

Sets the images to use when showing large, normal icons in this control.

These images are used by the items when the list control is in Wx::LC_ICON mode, in all the other modes the images set by #set_small_images are used. This function should be preferred to calling #set_image_list or assign_image_list with IMAGE_LIST_NORMAL argument in the new code, as using BitmapBundle makes it possible to specify multiple versions of the icons, allowing the control to choose the right one for the current DPI scaling.

Parameters:

  • images (Array<Wx::ImageBundle>)


1061
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1061

def set_normal_images(images) end

#set_single_style(style, add = true) ⇒ void Also known as: single_style=

This method returns an undefined value.

Adds or removes a single window style.

Parameters:

  • style (Integer)
  • add (Boolean) (defaults to: true)


1187
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1187

def set_single_style(style, add=true) end

#set_small_images(images) ⇒ void Also known as: small_images=

This method returns an undefined value.

Sets the images to use when showing small icons in this control.

These images are used by the items when the list control is in Wx::LC_SMALL_ICON or Wx::LC_REPORT mode, use #set_normal_images for the icons used in Wx::LC_ICON mode. This function should be preferred to calling #set_image_list or assign_image_list with IMAGE_LIST_SMALL argument in the new code, as using BitmapBundle makes it possible to specify multiple versions of the icons, allowing the control to choose the right one for the current DPI scaling.

Parameters:

  • images (Array<Wx::ImageBundle>)


1070
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1070

def set_small_images(images) end

#set_text_colour(col) ⇒ void Also known as: text_colour=

This method returns an undefined value.

Sets the text colour of the list control.

Parameters:



1193
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1193

def set_text_colour(col) end

#set_window_style_flag(style) ⇒ void Also known as: window_style_flag=

This method returns an undefined value.

Sets the whole window style, deleting all items.

Parameters:

  • style (Integer)


1199
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1199

def set_window_style_flag(style) end

#show_sort_indicator(col, ascending = true) ⇒ void

This method returns an undefined value.

Show the sort indicator of a specific column in a specific direction.

Sort indicators are only shown in report view and in the native WXMSW version override any column icon, i.e. if the sort indicator is shown for a column, no (other) icon is shown. This function should typically be called from EVT_LIST_COL_CLICK handler.

Note:

This does not actually sort the list, use #sort_items for this.

Parameters:

  • col (Integer)

    The column to set the sort indicator for. If -1 is given, then the currently shown sort indicator will be removed.

  • ascending (Boolean) (defaults to: true)

    If true or false show the sort indicator corresponding to ascending or descending sort order respectively.



1261
# File 'lib/wx/doc/gen/list_ctrl.rb', line 1261

def show_sort_indicator(col, ascending=true) end

#sort_items(data = nil) {|item_data1, item_data2, data| ... } ⇒ Object

Call this function to sort the items in the list control. The sorting method will call the given block repeatedly to compare two items from the list passing the item data for each item as well as the data argument given to the #sort_items method. The block should return 0 if the items are equal, negative value if the first item is less than the second one and positive value if the first one is greater than the second one.

Parameters:

  • data (::Object) (defaults to: nil)

    user data to pass on to the sorting block

Yield Parameters:

  • item_data1 (::Object)

    data for first item

  • item_data2 (::Object)

    data for second item

  • data (::Object)

    propagated data argument



38
# File 'lib/wx/doc/list_ctrl.rb', line 38

def sort_items(data = nil, &block) end