class
UIng::Table
- UIng::Table
- UIng::Control
- Reference
- Object
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:
- 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 ...
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.
Defined in:
uing/table/table.cruing/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
- .new(*args, &)
- .new(*args, **kwargs, &)
-
.new(model : Model, row_background_color_model_column : LibC::Int = -1)
IMPORTANT: This method accepts Table::Model instead of Table::Params
Instance Method Summary
- #append_button_column(name : String, button_model_column : Int32, button_clickable_model_column : Int32) : Nil
- #append_checkbox_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32) : Nil
- #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
- #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
- #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
- #append_image_column(name : String, image_model_column : Int32) : Nil
- #append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil
- #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
- #append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil
- #append_progress_bar_column(name : String, progress_model_column : Int32) : Nil
- #append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil
- #append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TableTextColumnOptionalParams) : Nil
- #append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32) : Nil
- #column_set_width(column : Int32, width : Int32) : Nil
- #column_width(column : Int32) : Int32
- #destroy
- #header_set_sort_indicator(column : Int32, sort_indicator : SortIndicator) : Nil
- #header_sort_indicator(column : Int32) : SortIndicator
- #header_visible=(value : Bool)
- #header_visible? : Bool
- #on_header_clicked(&block : LibC::Int -> _)
- #on_row_clicked(&block : LibC::Int -> _)
- #on_row_double_clicked(&block : LibC::Int -> _)
- #on_selection_changed(&block : Selection -> _)
- #selection : Selection
-
#selection(&block : Selection -> Nil) : Nil
Block version that automatically frees the selection after the block This eliminates the need for manual free() calls
- #selection=(selection : Selection) : Nil
- #selection_mode : Selection::Mode
- #selection_mode=(mode : Selection::Mode) : Nil
- #to_unsafe : Pointer(Void)
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
IMPORTANT: This method accepts Table::Model instead of Table::Params
Instance Method Detail
def append_button_column(name : String, button_model_column : Int32, button_clickable_model_column : Int32) : Nil
#
def append_checkbox_column(name : String, checkbox_model_column : Int32, checkbox_editable_model_column : Int32) : Nil
#
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
#
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
#
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
#
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
#
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
#
def append_image_text_column(name : String, image_model_column : Int32, text_model_column : Int32, text_editable_model_column : Int32) : Nil
#
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, color_model_column : Int32) : Nil
#
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32, table_text_column_optional_params : TableTextColumnOptionalParams) : Nil
#
def append_text_column(name : String, text_model_column : Int32, text_editable_model_column : Int32) : Nil
#
Block version that automatically frees the selection after the block This eliminates the need for manual free() calls