UIng::Table
Inherits UIng::Control < UIng::BlockConstructor < Reference < Object
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:
- Using on_selection_changed callback (RECOMMENDED):
table.on_selection_changed do |selection|
if selection.num_rows > 0
selected_row = selection.rows.first
... use selection data ...
endTable::Selection is automatically freed after this block
end
- 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
- Setting a custom Table::Selection object via
table.selection =: You can create a Table::Selection manually usingTable::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.
Constructors
new(*args, &)
Sourcenew(*args, **kwargs, &)
Sourcenew(model : Model, row_background_color_model_column : LibC::Int = -1)
IMPORTANT: This method accepts Table::Model instead of Table::Params
Instance methods
append_button_column(name : String, button_model_column : Int32, button_clickable_model_column : Int32) : Nil
Sourceappend_checkbox_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32) : Nil
Sourceappend_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 : TextColumnOptionalParams) : Nil
Sourceappend_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
Sourceappend_checkbox_text_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil
Sourceappend_image_column(name : String, image_model_column : Int32) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TextColumnOptionalParams) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil
Sourceappend_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil
Sourceappend_progress_bar_column(name : String, progress_model_column : Int32) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TextColumnOptionalParams) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil
Sourceappend_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32) : Nil
Sourcecolumn_set_width(column : Int32, width : Int32) : Nil
Sourcecolumn_width(column : Int32) : Int32
Sourceheader_set_sort_indicator(column : Int32, sort_indicator : SortIndicator) : Nil
Sourceheader_sort_indicator(column : Int32) : SortIndicator
Sourceheader_visible=(value : Bool)
Sourceheader_visible?
Sourceon_header_clicked
Sourceon_row_clicked
Sourceon_row_double_clicked
Sourceon_selection_changed
Sourceselection
Sourceselection
Block version that automatically frees the selection after the block This eliminates the need for manual free() calls
selection=(selection : Selection) : Nil
Sourceselection_mode
Sourceselection_mode=(mode : Selection::Mode) : Nil
Sourceto_unsafe
Source