class UIng::Table

Overview

Table::Selection represents selected rows in a Table.

AUTOMATIC MEMORY MANAGEMENT: Table::Selection is automatically managed by the UIng library. Users do NOT need to manually free Table::Selection objects.

Recommended usage patterns:

  1. Using on_selection_changed callback (RECOMMENDED): table.on_selection_changed do |selection| if selection.num_rows > 0 selected_row = selection.rows[0]

    ... use selection data ...

    end

    Table::Selection is automatically freed after this block

end

  1. Manual selection access (use with caution): selection = table.selection # Get selection rows = selection.num_rows # Extract data immediately

... use selection data ...

selection.free # MUST free manually when using this pattern

  1. Setting a custom Table::Selection object via table.selection =: You can create a Table::Selection manually using Table::Selection.new(...) and assign it to a table. The data will be immediately copied or consumed by libui-ng, so the object does not need to be freed manually. Memory is automatically managed by Crystal's garbage collector.

Defined in:

uing/table/table.cr
uing/table/table/model.cr
uing/table/table/model/handler.cr
uing/table/table/params.cr
uing/table/table/selection.cr
uing/table/table/selection/mode.cr
uing/table/table/sort_indicator.cr
uing/table/table/text_column_optional_params.cr
uing/table/table/value.cr
uing/table/table/value/type.cr

Constructors

Instance Method Summary

Instance methods inherited from class UIng::Control

__parent__ __parent__, __set_parent__(parent) : Nil __set_parent__, delete(child : Control) delete, destroy : Nil destroy, disable : Nil disable, enable : Nil enable, enabled? : Bool enabled?, enabled_to_user? : Bool enabled_to_user?, handle handle, hide : Nil hide, parent : Control | Nil parent, show : Nil show, to_unsafe to_unsafe, toplevel? : Bool toplevel?, verify_set_parent(parent) : Nil verify_set_parent, visible? : Bool visible?

Macros inherited from module UIng::BlockConstructor

block_constructor block_constructor

Constructor Detail

def self.new(*args, &) #

[View source]
def self.new(*args, **kwargs, &) #

[View source]
def self.new(model : Model, row_background_color_model_column : LibC::Int = -1) #

IMPORTANT: This method accepts Table::Model instead of Table::Params


[View source]

Instance Method Detail

def append_button_column(name : String, button_model_column : Int32, button_clickable_model_column : Int32) : Nil #

[View source]
def append_checkbox_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32) : Nil #

[View source]
def append_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil #

[View source]
def append_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TableTextColumnOptionalParams) : Nil #

[View source]
def append_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil #

[View source]
def append_image_column(name : String, image_model_column : Int32) : Nil #

[View source]
def append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil #

[View source]
def append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TableTextColumnOptionalParams) : Nil #

[View source]
def append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil #

[View source]
def append_progress_bar_column(name : String, progress_model_column : Int32) : Nil #

[View source]
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil #

[View source]
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TableTextColumnOptionalParams) : Nil #

[View source]
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32) : Nil #

[View source]
def column_set_width(column : Int32, width : Int32) : Nil #

[View source]
def column_width(column : Int32) : Int32 #

[View source]
def destroy #

[View source]
def header_set_sort_indicator(column : Int32, sort_indicator : SortIndicator) : Nil #

[View source]
def header_sort_indicator(column : Int32) : SortIndicator #

[View source]
def header_visible=(value : Bool) #

[View source]
def header_visible? : Bool #

[View source]
def on_header_clicked(&block : LibC::Int -> _) #

[View source]
def on_row_clicked(&block : LibC::Int -> _) #

[View source]
def on_row_double_clicked(&block : LibC::Int -> _) #

[View source]
def on_selection_changed(&block : Selection -> _) #

[View source]
def selection : Selection #

[View source]
def selection(&block : Selection -> Nil) : Nil #

Block version that automatically frees the selection after the block This eliminates the need for manual free() calls


[View source]
def selection=(selection : Selection) : Nil #

[View source]
def selection_mode : Selection::Mode #

[View source]
def selection_mode=(mode : Selection::Mode) : Nil #

[View source]
def to_unsafe : Pointer(Void) #

[View source]