Class: Wx::TreeCtrl

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

Overview

A tree control presents information as a hierarchy, with items that may be expanded to show further items.

Items in a tree control are referenced by TreeItemId handles, which may be tested for validity by calling Wx::TreeItemId#is_ok. A similar control with a fully native implementation for GTK+ and macOS as well is DataViewTreeCtrl.

Images in wxTreeCtrl

TreeCtrl inherits from WithImages classes providing the functions for associating images with the control items. Each item refers to its image using an index, which can possibly by WithImages::NO_IMAGE to indicate that the item doesn’t use any image at all, and the corresponding image is taken either from the vector passed to WithImages#set_images or from the image list passed to WithImages#set_image_list or WithImages#assign_image_list functions. In addition to normal images, handled with the methods mentioned above, TreeCtrl also provides optional state images that may be used to indicate some additional state of the item, e.g. checked or unchecked status. These images can be set using #set_state_images (preferred, as they allow to specify high resolution versions of the state images too) or legacy #set_state_image_list and assign_state_image_list functions that behave in the same way as the corresponding methods of WithImages. Note that state images are currently not supported in the native Qt version. Finally, in the generic version of this control (GenericTreeCtrl), also provides #set_buttons_image_list and assign_buttons_image_list, which can be used to change the images used for the control buttons, used to expand or collapse its branches. These methods are not available in the native WXMSW and Qt implementations.

Events

To intercept events from a tree control, use the event table macros described in TreeEvent.

Styles

This class supports the following styles:

  • TR_EDIT_LABELS: Use this style if you wish the user to be able to edit labels in the tree control.

  • TR_NO_BUTTONS: For convenience to document that no buttons are to be drawn.

  • TR_HAS_BUTTONS: Use this style to show + and - buttons to the left of parent items.

  • TR_TWIST_BUTTONS: Selects alternative style of +/- buttons and shows rotating ("twisting") arrows instead. Currently this style is only implemented in WXMSW and is ignored under the other platforms as enabling it is equivalent to using Wx::SystemThemedControl#enable_system_theme.

  • TR_NO_LINES: Use this style to hide vertical level connectors.

  • TR_FULL_ROW_HIGHLIGHT: Use this style to have the background colour and the selection highlight extend over the entire horizontal row of the tree control window. (This flag is ignored under Windows unless you specify TR_NO_LINES as well.)

  • TR_LINES_AT_ROOT: Use this style to show lines leading to the root nodes (unless no TR_NO_LINES is also used, in which case no lines are shown). Note that in the MSW version, if this style is omitted, not only the lines, but also the button used for expanding the root item is not shown, which can be unexpected, so it is recommended to always use it.

  • TR_HIDE_ROOT: Use this style to suppress the display of the root node, effectively causing the first-level nodes to appear as a series of root nodes. Note that in WXMSW this style must be set when creating the control and can't be changed later.

  • TR_ROW_LINES: Use this style to draw a contrasting border between displayed rows.

  • TR_HAS_VARIABLE_ROW_HEIGHT: Use this style to cause row heights to be just big enough to fit the content. If not set, all rows use the largest row height. The default is that this flag is unset. Generic only.

  • TR_SINGLE: For convenience to document that only one item may be selected at a time. Selecting another item causes the current selection, if any, to be deselected. This is the default.

  • TR_MULTIPLE: Use this style to allow a range of items to be selected. If a second range is selected, the current range, if any, is deselected.

  • TR_DEFAULT_STYLE: The set of flags that are closest to the defaults for the native control for a particular toolkit.

Events emitted by this class

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

See also Window Styles.

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_TREECTRL

Instance Method Summary collapse

Methods included from WithImages

#get_image_count, #get_image_list, #get_updated_image_list_for, #has_images, #set_image_list, #set_images

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_prepare_update_window_ui, #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_cursor_bundle, #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_parent, #get_popup_menu_selection_from_user, #get_position, #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, #msw_disable_composited, #navigate, #navigate_in, new_control_id, #on_internal_idle, #page_down, #page_up, #paint, #paint_buffered, #pop_event_handler, #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_colour, #set_background_style, #set_can_focus, #set_caret, #set_client_size, #set_containing_sizer, #set_cursor, #set_cursor_bundle, #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_flag, #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_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_label_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_label_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_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_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, #try_after, #try_before, #unlink

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::TreeCtrl #initialize(parent, id = Wx::StandardID::ID_ANY, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::TR_DEFAULT_STYLE, validator = Wx::DEFAULT_VALIDATOR, name = Wx::TREE_CTRL_NAME_STR) ⇒ Wx::TreeCtrl #initialize(parent, id = Wx::StandardID::ID_ANY, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::TR_DEFAULT_STYLE, validator = Wx::DEFAULT_VALIDATOR, name = Wx::TREE_CTRL_NAME_STR) {|win| ... } ⇒ Wx::TreeCtrl

Returns a new instance of TreeCtrl.

Overloads:

  • #initializeWx::TreeCtrl

    Default Constructor.

  • #initialize(parent, id = Wx::StandardID::ID_ANY, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::TR_DEFAULT_STYLE, validator = Wx::DEFAULT_VALIDATOR, name = Wx::TREE_CTRL_NAME_STR) ⇒ Wx::TreeCtrl

    Constructor, creating and showing a tree control.

    Parameters:

    • parent (Wx::Window)

      Parent window. Must not be nil.

    • id (Integer) (defaults to: Wx::StandardID::ID_ANY)

      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::TR_DEFAULT_STYLE)

      Window style. See Wx::TreeCtrl.

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

      Window validator.

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

      Window name.

    See Also:

  • #initialize(parent, id = Wx::StandardID::ID_ANY, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::TR_DEFAULT_STYLE, validator = Wx::DEFAULT_VALIDATOR, name = Wx::TREE_CTRL_NAME_STR) {|win| ... } ⇒ Wx::TreeCtrl

    Constructor, creating and showing a tree control.

    Parameters:

    • parent (Wx::Window)

      Parent window. Must not be nil.

    • id (Integer) (defaults to: Wx::StandardID::ID_ANY)

      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::TR_DEFAULT_STYLE)

      Window style. See Wx::TreeCtrl.

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

      Window validator.

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

      Window name.

    Yield Parameters:

    See Also:



375
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 375

def initialize(*args) end

Instance Method Details

#add_root(text, image = -1,, selImage = -1,, data = nil) ⇒ Wx::TreeItemId

Adds the root node to the tree, returning the new item.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

Parameters:

  • text (String)
  • image (Integer) (defaults to: -1,)
  • selImage (Integer) (defaults to: -1,)
  • data (Object) (defaults to: nil)

Returns:



385
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 385

def add_root(text, image=-1, selImage=-1, data=nil) end

#append_item(parent, text, image = -1,, selImage = -1,, data = nil) ⇒ Wx::TreeItemId

Appends an item to the end of the branch identified by parent, return a new item id.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

Parameters:

  • parent (Wx::TreeItemId)
  • text (String)
  • image (Integer) (defaults to: -1,)
  • selImage (Integer) (defaults to: -1,)
  • data (Object) (defaults to: nil)

Returns:



396
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 396

def append_item(parent, text, image=-1, selImage=-1, data=nil) end

#clear_focused_itemvoid

This method returns an undefined value.

Clears the currently focused item.



562
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 562

def clear_focused_item; end

#collapse(item) ⇒ void

This method returns an undefined value.

Collapses the given item.

Parameters:



401
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 401

def collapse(item) end

#collapse_allvoid

This method returns an undefined value.

Collapses the root item.

See Also:



408
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 408

def collapse_all; end

#collapse_all_children(item) ⇒ void

This method returns an undefined value.

Collapses this item and all of its children, recursively.

Parameters:

See Also:



416
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 416

def collapse_all_children(item) end

#collapse_and_reset(item) ⇒ void

This method returns an undefined value.

Collapses the given item and removes all children.

Parameters:



421
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 421

def collapse_and_reset(item) end

#create(parent, id = Wx::StandardID::ID_ANY, pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::TR_DEFAULT_STYLE, validator = Wx::DEFAULT_VALIDATOR, name = Wx::TREE_CTRL_NAME_STR) ⇒ Boolean

Creates the tree control.

See #initialize for further details.

Parameters:

  • parent (Wx::Window)
  • id (Integer) (defaults to: Wx::StandardID::ID_ANY)
  • 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::TR_DEFAULT_STYLE)
  • validator (Wx::Validator) (defaults to: Wx::DEFAULT_VALIDATOR)
  • name (String) (defaults to: Wx::TREE_CTRL_NAME_STR)

Returns:

  • (Boolean)


434
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 434

def create(parent, id=Wx::StandardID::ID_ANY, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::TR_DEFAULT_STYLE, validator=Wx::DEFAULT_VALIDATOR, name=Wx::TREE_CTRL_NAME_STR) end

#delete(item) ⇒ void

This method returns an undefined value.

Deletes the specified item.

A EVT_TREE_DELETE_ITEM event will be generated. This function may cause a subsequent call to #get_next_child to fail.

Parameters:



442
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 442

def delete(item) end

#delete_all_itemsvoid

This method returns an undefined value.

Deletes all items in the control.

This function generates EVT_TREE_DELETE_ITEM events for each item being deleted, including the root one if it is shown, i.e. unless Wx::TR_HIDE_ROOT style is used.



448
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 448

def delete_all_items; end

#delete_children(item) ⇒ void

This method returns an undefined value.

Deletes all children of the given item (but not the item itself).

A EVT_TREE_DELETE_ITEM event will be generated for every item being deleted. If you have called #set_item_has_children, you may need to call it again since #delete_children does not automatically clear the setting.

Parameters:



456
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 456

def delete_children(item) end

#each_item_child(parent_id) {|child_id| ... } ⇒ Object #each_item_child(parent_id) ⇒ Enumerator

Iterate all child items of the given parent and yield it’s id to the given block. Returns an Enumerator if no block given.

Overloads:

  • #each_item_child(parent_id) {|child_id| ... } ⇒ Object

    Returns last result of block.

    Parameters:

    Yield Parameters:

    Returns:

    • (Object)

      last result of block

  • #each_item_child(parent_id) ⇒ Enumerator

    Returns enumerator.

    Parameters:

    Returns:

    • (Enumerator)

      enumerator



53
# File 'lib/wx/doc/tree_ctrl.rb', line 53

def each_item_child(parent_id) end

#edit_label(item_id) ⇒ void

This method returns an undefined value.

Starts editing the label of the given item. This function generates a EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed to prevent the editing from starting. If it does start, a text control, which can be retrieved using GetEditControl(), allowing the user to edit the label interactively is shown. When the editing ends, EVT_TREE_END_LABEL_EDIT event is sent and this event can be vetoed as well to prevent the label from changing. Note that this event is sent both when the user accepts (e.g. by pressing Enter) or cancels (e.g. by pressing Escape) and its handler can use wxTreeEvent::IsEditCancelled() to distinguish between these situations.

Parameters:



95
# File 'lib/wx/doc/tree_ctrl.rb', line 95

def edit_label(item_id) 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)


463
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 463

def enable_bell_on_no_match(on=true) end

#end_edit_label(item, discardChanges = false) ⇒ void

This method returns an undefined value.

Ends label editing.

If cancelEdit is true, the edit will be cancelled.

Note:

This function is currently supported under Windows only.

Parameters:

See Also:



478
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 478

def end_edit_label(item, discardChanges=false) end

#ensure_visible(item) ⇒ void

This method returns an undefined value.

Scrolls and/or expands items to ensure that the given item is visible.

This method can be used, and will work, even while the window is frozen (see Window#freeze).

Parameters:



485
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 485

def ensure_visible(item) end

#expand(item) ⇒ void

This method returns an undefined value.

Expands the given item.

Parameters:



490
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 490

def expand(item) end

#expand_allvoid

This method returns an undefined value.

Expands all items in the tree.



494
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 494

def expand_all; end

#expand_all_children(item) ⇒ void

This method returns an undefined value.

Expands the given item and all its children recursively.

Parameters:



499
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 499

def expand_all_children(item) end

#get_bounding_rect(item, rect, textOnly = false) ⇒ Boolean Also known as: bounding_rect

Retrieves the rectangle bounding the item.

If textOnly is true, only the rectangle around the item’s label will be returned, otherwise the item’s image is also taken into account. The return value is true if the rectangle was successfully retrieved or false if it was not (in this case rect is not changed) for example, if the item is currently invisible. Notice that the rectangle coordinates are logical, not physical ones. So, for example, the x coordinate may be negative if the tree has a horizontal scrollbar and its position is not 0.

Parameters:

Returns:

  • (Boolean)


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

def get_bounding_rect(item, rect, textOnly=false) end

#get_buttons_image_listWx::ImageList Also known as: buttons_image_list

Returns the buttons image list (from which application-defined button images are taken).

This function is only available in the generic version.

Returns:

Requires:

  • WXGTK or WXOSX


518
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 518

def get_buttons_image_list; end

#get_children_count(item, recursively = true) ⇒ Integer Also known as: children_count

Returns the number of items in the branch.

If recursively is true, returns the total number of descendants, otherwise only one level of children is counted.

Parameters:

Returns:

  • (Integer)


527
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 527

def get_children_count(item, recursively=true) end

#get_countInteger Also known as: count

Returns the number of items in the control.

Returns:

  • (Integer)


532
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 532

def get_count; end

#get_edit_controlWx::TextCtrl Also known as: edit_control

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

Returns nil if no label is being edited.

Note:

This is currently only implemented for WXMSW.

Returns:



545
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 545

def get_edit_control; end

#get_first_child(parent_id) ⇒ Array(Wx::TreeItemId, Object)

Returns the first child; call #get_next_child() for the next child. For this enumeration method a ‘cookie’ is returned which is opaque for the application but is necessary for the library to make these methods reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie returned from (and passed to) #get_first_child() and #get_next_child() should be the same variable.

Returns an invalid tree item (i.e. Wx::TreeItemId#ok? returns false) if there are no further children.

Parameters:

  • parent_id (Wx::TreeItemId)

    the id of the parent tree item for which to iterate children

Returns:



30
# File 'lib/wx/doc/tree_ctrl.rb', line 30

def get_first_child(parent_id) end

#get_first_visible_itemWx::TreeItemId Also known as: first_visible_item

Returns the first visible item.

Returns:



550
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 550

def get_first_visible_item; end

#get_focused_itemWx::TreeItemId Also known as: focused_item

Returns the item last clicked or otherwise selected.

Unlike #get_selection, it can be used whether or not the control has the Wx::TR_MULTIPLE style.

Returns:



557
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 557

def get_focused_item; end

#get_indentInteger Also known as: indent

Returns the current tree control indentation in DPI independent pixels.

Returns:

  • (Integer)


572
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 572

def get_indent; end

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

Returns the background colour of the item.

Parameters:

Returns:



585
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 585

def get_item_background_colour(item) end

#get_item_children(parent_id) ⇒ Array<Wx::TreeItemId> Also known as: item_children

Returns an array of tree item ids of the child items of the given parent.

Parameters:

Returns:



58
# File 'lib/wx/doc/tree_ctrl.rb', line 58

def get_item_children(parent_id) end

#get_item_data(item) ⇒ Object Also known as: item_data

Returns the tree item data associated with the item.

  • GetPlData(item): returns the Perl data associated with the Wx::TreeItemData. It is just the same as tree->GetItemData(item)->GetData().

Parameters:

Returns:

See Also:

  • Wx::TreeItemData


594
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 594

def get_item_data(item) end

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

Returns the font of the item label.

If the font hadn’t been explicitly set for the specified item with #set_item_font, returns an invalid NULL_FONT font. Window#get_font can be used to retrieve the global tree control font used for the items without any specific font.

Parameters:

Returns:



602
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 602

def get_item_font(item) end

#get_item_image(item, which = Wx::TreeItemIcon::TreeItemIcon_Normal) ⇒ Integer Also known as: item_image

Gets the specified item image.

The value of which may be:

Parameters:

Returns:

  • (Integer)


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

def get_item_image(item, which=Wx::TreeItemIcon::TreeItemIcon_Normal) end

#get_item_parent(item) ⇒ Wx::TreeItemId Also known as: item_parent

Returns the item’s parent.

Parameters:

Returns:



622
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 622

def get_item_parent(item) end

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

Gets the specified item state.

Parameters:

Returns:

  • (Integer)


628
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 628

def get_item_state(item) end

#get_item_text(item) ⇒ String Also known as: item_text

Returns the item label.

Parameters:

Returns:

  • (String)


634
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 634

def get_item_text(item) end

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

Returns the colour of the item label.

Parameters:

Returns:



640
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 640

def get_item_text_colour(item) end

#get_last_child(item) ⇒ Wx::TreeItemId Also known as: last_child

Returns the last child of the item (or an invalid tree item if this item has no children).



651
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 651

def get_last_child(item) end

#get_next_child(parent_id, cookie) ⇒ Array(Wx::TreeItemId, Object)

Returns the next child; call #get_first_child() for the first child. For this enumeration function you must pass in a ‘cookie’ parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). The cookie returned from (and passed to) #get_first_child() and #get_next_child() should be the same variable.

Returns an invalid tree item if there are no further children.

Parameters:

  • parent_id (Wx::TreeItemId)

    the id of the parent tree item for which to iterate children

  • cookie (::Object)

    cookie value as returned from previous #get_first_cild or #get_next_child call.

Returns:



42
# File 'lib/wx/doc/tree_ctrl.rb', line 42

def get_next_child(parent_id, cookie) end

#get_next_sibling(item) ⇒ Wx::TreeItemId Also known as: next_sibling

Returns the next sibling of the specified item; call #get_prev_sibling for the previous sibling.

Returns an invalid tree item if there are no further siblings.

Parameters:

Returns:

See Also:



660
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 660

def get_next_sibling(item) end

#get_next_visible(item) ⇒ Wx::TreeItemId Also known as: next_visible

Returns the next visible item or an invalid item if this item is the last visible one.

Note:

The item itself must be visible.

Parameters:

Returns:



672
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 672

def get_next_visible(item) end

#get_prev_sibling(item) ⇒ Wx::TreeItemId Also known as: prev_sibling

Returns the previous sibling of the specified item; call #get_next_sibling for the next sibling.

Returns an invalid tree item if there are no further children.

Parameters:

Returns:

See Also:



681
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 681

def get_prev_sibling(item) end

#get_prev_visible(item) ⇒ Wx::TreeItemId Also known as: prev_visible

Returns the previous visible item or an invalid item if this item is the first visible one.

Note:

The item itself must be visible.

Parameters:

Returns:



693
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 693

def get_prev_visible(item) end

#get_quick_best_sizeBoolean Also known as: quick_best_size

Returns true if the control will use a quick calculation for the best size, looking only at the first and last items.

The default is false.

Returns:

  • (Boolean)

See Also:



701
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 701

def get_quick_best_size; end

#get_root_itemWx::TreeItemId Also known as: root_item

Returns the root item for the tree control.

Returns:



706
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 706

def get_root_item; end

#get_root_itemsArray<Wx::TreeItemId>

Returns an array of tree item ids of the current child items of the root. Mainly useful for tree control using TR_HIDE_ROOT style where there are multiple root-like items.

Returns:



65
# File 'lib/wx/doc/tree_ctrl.rb', line 65

def get_root_items; end

#get_selectionWx::TreeItemId Also known as: selection

Returns the selection, or an invalid item if there is no selection.

This function only works with the controls without Wx::TR_MULTIPLE style, use #get_selections for the controls which do have this style or, if a single item is wanted, use #get_focused_item.

Returns:



713
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 713

def get_selection; end

#get_selectionsArray<Wx::TreeItemId>

Returns an array of tree item ids of the currently selected items. This function can be called only if the control has the wxTR_MULTIPLE style.

Returns:



70
# File 'lib/wx/doc/tree_ctrl.rb', line 70

def get_selections; end

#get_spacingInteger Also known as: spacing

Returns the current tree control spacing.

This is the number of horizontal DIPs (DPI independent pixels) between the buttons and the state images.

Returns:

  • (Integer)


579
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 579

def get_spacing; end

#get_state_image_countInteger Also known as: state_image_count

Returns the number of state images used by the control.

Returns the number of images passed to the last call to #set_state_images or 0 if it had been never called.

Returns:

  • (Integer)

See Also:



721
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 721

def get_state_image_count; end

#get_state_image_listWx::ImageList Also known as: state_image_list

Returns the state image list (from which application-defined state images are taken).



730
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 730

def get_state_image_list; end

#has_state_imagesBoolean Also known as: has_state_images?

Returns true if the control uses any state images.

This is equivalent to comparing #get_state_image_count return value with 0 but more clear.

Returns:

  • (Boolean)

See Also:



739
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 739

def has_state_images; end

#hit_test(point) ⇒ Array(Wx::TreeItemId,Integer)

Calculates which (if any) item is under the given point, returning the tree item id at this point plus extra information flags.

flags is a bitlist of the following:

Parameters:

Returns:



759
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 759

def hit_test(point) end

#insert_item(parent, previous, text, image = -1,, selImage = -1,, data = nil) ⇒ Wx::TreeItemId

Inserts an item after a given one (previous).

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

Parameters:

  • parent (Wx::TreeItemId)
  • previous (Wx::TreeItemId)
  • text (String)
  • image (Integer) (defaults to: -1,)
  • selImage (Integer) (defaults to: -1,)
  • data (Object) (defaults to: nil)

Returns:



771
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 771

def insert_item(parent, previous, text, image=-1, selImage=-1, data=nil) end

#insert_item_before(parent, pos, text, image = -1,, selImage = -1,, data = nil) ⇒ Wx::TreeItemId

Inserts an item before one identified by its position (pos). pos must be less than or equal to the number of children. The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

Parameters:

  • parent (Wx::TreeItemId)

    parent tree item id to insert child item for

  • pos (Integer)

    child item’s position to insert before

  • image (Integer) (defaults to: -1,)

    image index for unselected item

  • selImage (Integer) (defaults to: -1,)

    image index for selected item

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

Returns:



83
# File 'lib/wx/doc/tree_ctrl.rb', line 83

def insert_item_before(parent, pos, text, image=-1, selImage=-1, data=nil) end

#is_bold(item) ⇒ Boolean Also known as: bold?

Returns true if the given item is in bold state.

Parameters:

Returns:

  • (Boolean)

See Also:



779
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 779

def is_bold(item) end

#is_emptyBoolean Also known as: empty?

Returns true if the control is empty (i.e. has no items, even no root one).

Returns:

  • (Boolean)


784
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 784

def is_empty; end

#is_expanded(item) ⇒ Boolean Also known as: expanded?

Returns true if the item is expanded (only makes sense if it has children).

Parameters:

Returns:

  • (Boolean)


790
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 790

def is_expanded(item) end

#is_selected(item) ⇒ Boolean Also known as: selected?

Returns true if the item is selected.

Parameters:

Returns:

  • (Boolean)


796
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 796

def is_selected(item) end

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

Returns true if the item is visible on the screen.

Parameters:

Returns:

  • (Boolean)


802
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 802

def is_visible(item) end

#item_has_children(item) ⇒ Boolean

Returns true if the item has children.

Parameters:

Returns:

  • (Boolean)


808
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 808

def item_has_children(item) end

#on_compare_items(item1, item2) ⇒ Integer

Override this function in the derived class to change the sort order of the items in the tree control.

The function should return a negative, zero or positive value if the first item is less than, equal to or greater than the second one. Please note that you must use RTTI macros declare_dynamic_class and implement_dynamic_class if you override this function because otherwise the base class considers that it is not overridden and uses the default comparison, i.e. sorts the items alphabetically, which allows it optimize away the calls to the virtual function completely.

Parameters:

Returns:

  • (Integer)

See Also:



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

def on_compare_items(item1, item2) end

#prepend_item(parent, text, image = -1,, selImage = -1,, data = nil) ⇒ Wx::TreeItemId

Appends an item as the first child of parent, return a new item id.

The image and selImage parameters are an index within the normal image list specifying the image to use for unselected and selected items, respectively. If image > -1 and selImage is -1, the same image is used for both selected and unselected items.

Parameters:

  • parent (Wx::TreeItemId)
  • text (String)
  • image (Integer) (defaults to: -1,)
  • selImage (Integer) (defaults to: -1,)
  • data (Object) (defaults to: nil)

Returns:



829
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 829

def prepend_item(parent, text, image=-1, selImage=-1, data=nil) end

#scroll_to(item) ⇒ void

This method returns an undefined value.

Scrolls the specified item into view.

Note that this method doesn’t work while the window is frozen (See Window#freeze), at least under MSW.

Parameters:

See Also:



837
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 837

def scroll_to(item) end

#select_children(parent) ⇒ void

This method returns an undefined value.

Select all the immediate children of the given parent.

This function can be used with multiselection controls only.

Parameters:



1049
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1049

def select_children(parent) end

#select_item(item, select = true) ⇒ void

This method returns an undefined value.

Selects the given item.

In multiple selection controls, can be also used to deselect a currently selected item if the value of select is false. Notice that calling this method will generate EVT_TREE_SEL_CHANGING and EVT_TREE_SEL_CHANGED events and that the change could be vetoed by the former event handler.

Parameters:



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

def select_item(item, select=true) end

#set_buttons_image_list(imageList) ⇒ void Also known as: buttons_image_list=

This method returns an undefined value.

Sets the buttons image list (from which application-defined button images are taken).

The button images assigned with this method will not be deleted by Wx::TreeCtrl‘s destructor, you must delete it yourself. Setting or assigning the button image list enables the display of image buttons. Once enabled, the only way to disable the display of button images is to set the button image list to nil.

Note:

This function is only available in the generic version.

Parameters:

See Also:

  • assign_buttons_image_list.

Requires:

  • WXGTK or WXOSX


861
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 861

def set_buttons_image_list(imageList) end

#set_focused_item(item) ⇒ void Also known as: focused_item=

This method returns an undefined value.

Sets the currently focused item.

Parameters:

  • item (Wx::TreeItemId)

    The item to make the current one. It must be valid.



567
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 567

def set_focused_item(item) end

#set_indent(indent) ⇒ void Also known as: indent=

This method returns an undefined value.

Sets the indentation for the tree control, in DIP (DPI independent pixels).

Parameters:

  • indent (Integer)


867
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 867

def set_indent(indent) end

#set_item_background_colour(item, col) ⇒ void

This method returns an undefined value.

Sets the colour of the item’s background.

Parameters:



882
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 882

def set_item_background_colour(item, col) end

#set_item_bold(item, bold = true) ⇒ void Also known as: item_bold=

This method returns an undefined value.

Makes item appear in bold font if bold parameter is true or resets it to the normal state.

Parameters:

See Also:



891
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 891

def set_item_bold(item, bold=true) end

#set_item_data(item, data) ⇒ void

This method returns an undefined value.

Sets the item client data.

Notice that the client data previously associated with the item (if any) is not freed by this function and so calling this function multiple times for the same item will result in memory leaks unless you delete the old item data pointer yourself.

Parameters:



900
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 900

def set_item_data(item, data) end

#set_item_drop_highlight(item, highlight = true) ⇒ void Also known as: item_drop_highlight=

This method returns an undefined value.

Gives the item the visual feedback for Drag’n’Drop actions, which is useful if something is dragged from the outside onto the tree control (as opposed to a DnD operation within the tree control, which already is implemented internally).

Parameters:



906
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 906

def set_item_drop_highlight(item, highlight=true) end

#set_item_font(item, font) ⇒ void

This method returns an undefined value.

Sets the item’s font.

All items in the tree should have the same height to avoid text clipping, so the fonts height should be the same for all of them, although font attributes may vary.

Parameters:

See Also:



916
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 916

def set_item_font(item, font) end

#set_item_has_children(item, hasChildren = true) ⇒ void Also known as: item_has_children=

This method returns an undefined value.

Force appearance of the button next to the item.

This is useful to allow the user to expand the items which don’t have any children now, but instead adding them only when needed, thus minimizing memory usage and loading time.

Parameters:



924
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 924

def set_item_has_children(item, hasChildren=true) end

#set_item_image(item, image, which = Wx::TreeItemIcon::TreeItemIcon_Normal) ⇒ void

This method returns an undefined value.

Sets the specified item’s image.

See #get_item_image for the description of the which parameter.

Parameters:



934
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 934

def set_item_image(item, image, which=Wx::TreeItemIcon::TreeItemIcon_Normal) end

#set_item_state(item, state) ⇒ void

This method returns an undefined value.

Sets the specified item state.

The value of state may be an index into the state image list, or one of the special values:

Parameters:



946
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 946

def set_item_state(item, state) end

#set_item_text(item, text) ⇒ void

This method returns an undefined value.

Sets the item label.

Parameters:



952
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 952

def set_item_text(item, text) end

#set_item_text_colour(item, col) ⇒ void

This method returns an undefined value.

Sets the colour of the item’s text.

Parameters:



958
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 958

def set_item_text_colour(item, col) end

#set_quick_best_size(quickBestSize) ⇒ void Also known as: quick_best_size=

This method returns an undefined value.

If true is passed, specifies that the control will use a quick calculation for the best size, looking only at the first and last items.

Otherwise, it will look at all items. The default is false.

Parameters:

  • quickBestSize (Boolean)

See Also:



966
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 966

def set_quick_best_size(quickBestSize) end

#set_spacing(spacing) ⇒ void Also known as: spacing=

This method returns an undefined value.

Sets the spacing for the tree control.

Spacing is the number of horizontal DIPs (DPI independent pixels) between the buttons and the state images. This has no effect under WXMSW.

Parameters:

  • spacing (Integer)


875
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 875

def set_spacing(spacing) end

#set_state_image_list(imageList) ⇒ void Also known as: state_image_list=

This method returns an undefined value.

Sets the state image list (from which application-defined state images are taken).

Image list assigned with this method will not be deleted by Wx::TreeCtrl‘s destructor, you must delete it yourself.

Note:

Prefer using #set_state_images in the new code.

Parameters:

See Also:

  • assign_state_image_list


981
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 981

def set_state_image_list(imageList) end

#set_state_images(images) ⇒ void Also known as: state_images=

This method returns an undefined value.

Sets the images to use for the application-defined item states.

This function takes a vector of BitmapBundle objects which can specify multiple versions of the same icon for different display resolutions for each state. If the vector is empty, no state images are shown.

Parameters:

  • images (Array<Wx::ImageBundle>)

See Also:



991
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 991

def set_state_images(images) end

#set_window_style(styles) ⇒ void Also known as: window_style=

This method returns an undefined value.

Sets the mode flags associated with the display of the tree control.

The new mode takes effect immediately.

Note:

Generic only; MSW ignores changes.

Parameters:

  • styles (Integer)


1005
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1005

def set_window_style(styles) end

#sort_children(item) ⇒ void

This method returns an undefined value.

Sorts the children of the given item using #on_compare_items.

You should override that method to change the sort order (the default is ascending case-sensitive alphabetical order).

Parameters:

See Also:



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

def sort_children(item) end

#toggle(item) ⇒ void

This method returns an undefined value.

Toggles the given item between collapsed and expanded states.

Parameters:



1020
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1020

def toggle(item) end

#toggle_item_selection(item) ⇒ void

This method returns an undefined value.

Toggles the given item between selected and unselected states.

For multiselection controls only.

Parameters:



1027
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1027

def toggle_item_selection(item) end

#traverse(start_id = nil) {|child_id| ... } ⇒ Object, Enumerator Also known as: each

Yield each tree item id (recursively) to the given block. Starts at tree item specified or at root if none specified. Returns an Enumerator if no block given.

Parameters:

Yield Parameters:

Returns:

  • (Object, Enumerator)

    last result of block or Enumerator if no block given.



18
# File 'lib/wx/doc/tree_ctrl.rb', line 18

def traverse(start_id=nil) end

#unselectvoid

This method returns an undefined value.

Removes the selection from the currently selected item (if any).



1031
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1031

def unselect; end

#unselect_allvoid

This method returns an undefined value.

This function either behaves the same as #unselect if the control doesn’t have Wx::TR_MULTIPLE style, or removes the selection from all items if it does have this style.



1035
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1035

def unselect_all; end

#unselect_item(item) ⇒ void

This method returns an undefined value.

Unselects the given item.

This works in multiselection controls only.

Parameters:



1042
# File 'lib/wx/doc/gen/tree_ctrl.rb', line 1042

def unselect_item(item) end