PreviousUpNext

15.4.1298  src/lib/tk/src/toolkit/tests+examples/table_ex.pkg

## table_ex.pkg
## (C) 1999, Bremen Institute for Safe Systems, Universitaet Bremen
## Author: ludi

# Compiled by:
#     src/lib/tk/src/toolkit/tests+examples/sources.sublib



# **************************************************************************
# tk-Tables example
# **************************************************************************

package table_ex: (weak)     api {                                                      
                           go:  Void -> Void;
                       }
{

    include tk;

    fun blue_text s
        =
        LIVE_TEXT {
            text_items => [TEXT_ITEM_TAG { text_item_id   => make_text_item_id(),
                                        marks   => [(MARK (1, 0), MARK_END)],
                                        traits => [FOREGROUND BLUE,
                                                   UNDERLINE],
                                        event_callbacks => [] } ],
            len         => NULL,
            str         => s
        };
                                                                            my
    tab
        =
        table::table table::std_conf
          [[blue_text "Widgets", blue_text "Traits", blue_text "Comment"],
           [string_to_livetext "Button", string_to_livetext "Foreground, Background, ...",
            string_to_livetext "Simple button Widget"],
           [string_to_livetext "Label", string_to_livetext "Foreground, Background, ...",
            string_to_livetext "Simple text label"],
           [string_to_livetext "TextWid", string_to_livetext "Foreground, Background,\nText, ...",
            string_to_livetext "Text entry widget"],
           [string_to_livetext "Entry", string_to_livetext "Foreground, Background, ...",
            string_to_livetext "Line entry widget"],
           [string_to_livetext "Frame", string_to_livetext "Foreground, Background, ...",
            string_to_livetext "Container"],
           [string_to_livetext "...", string_to_livetext "...", string_to_livetext "..."]];
                                                                            my
    quitbutton
        =
        BUTTON {
            widget_id => make_widget_id(),
            packing_hints => [],
            traits  => [TEXT "Quit", CALLBACK (fn _ => exit_tcl(); end )],
            event_callbacks => []
        };

    fun go ()
        =
        start_tcl [
            make_window {
                window_id    => make_window_id (),
                subwidgets  => PACKED [tab, quitbutton],
                traits  => [WINDOW_TITLE "Table example"],
                event_callbacks => [],
                init     => null_callback
            }
        ];
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext