Class: LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample
- Inherits:
-
Object
- Object
- LibuiParadise::GUI::LibUI::EntryRespondsToCommentAsSynonymousToTheEnterKeyPressedExample
show all
- Includes:
- BaseModule
- Defined in:
- lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb
Overview
Constant Summary
collapse
- TITLE =
'Showcasing how to use "#" as synonymous to the ENTER key pressed'
- WIDTH =
1200
- HEIGHT =
120
Instance Method Summary
collapse
Methods included from BaseModule
#abort_on_exception, #append_this_array_to_that_combobox, #area, #assumed_height?, #assumed_width?, #bold_button, #bold_label, #bold_text_left_aligned, #button, #chdir, #checkbox, #checked_checkbox, #close_properly, #colour_button, #colour_to_rgb, #combobox, #commandline_arguments?, #connect_skeleton, #copy, #copy_file, #create_directory, #create_grid, #create_skeleton_then_connect_skeleton, #create_table, #create_the_skeleton, #current_widget_pointer_type?, #delete_file, #do_quit, #editable_combobox, #entry, #error_msg, #esystem, #exit_from, #fancy_text, #font, #font_button, #free_table_model, #gtk3?, #hbox, #height?, #horizontal_separator, #image, #is_on_roebe?, #is_on_windows?, #label, #last_pointer?, #left_arrow?, #main_hash?, #main_then_quit, #menu, #message_box_error, #multiline_entry, #new_brush, #non_wrapping_multiline_entry, #parse_this_file_into_a_table, #password_entry, #quit_button, #radio_buttons, #register_this_fiddle_pointer_widget, #reset_the_internal_hash, #return_button_for_opening_a_local_file, #return_default_window, #return_pwd, #return_the_resolution_using_xrandr, #run_main, #scrolling_area, #search_entry, #selected?, #set_commandline_arguments, #set_height, #set_main_window, #set_title, #set_width, #set_window, #sfancy, #sfile, #slider, #spinbox, #tab, #table, #text?, #text_layout, #title?, #title_width_height, #title_width_height_font, #try_to_parse_this_config_file, #try_to_use_this_font, #two_elements_hbox, #ui_draw_text_layout_params, #ui_font_descriptor, #ui_margined_main_window, #ui_msg_box, #ui_open_file, #ui_padded_grid, #ui_padded_hbox, #ui_padded_vbox, #ui_sync_connect, #ui_table_params_malloc, #ui_text_then_entry, #use_gtk3?, #use_gtk?, #use_libui?, #vbox, #vertical_separator, #width?, #window, #window?, #without_trailing_comment, #wrapper_new_progress_bar
Constructor Details
36
37
38
39
40
41
|
# File 'lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb', line 36
def initialize(
run_already = true
)
reset
run if run_already
end
|
Instance Method Details
#create_skeleton ⇒ Object
#
create_skeleton (create tag, skeleton tag)
#
54
55
56
57
58
59
|
# File 'lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb', line 54
def create_skeleton
@window = create_padded_main_window(title?, width?, height?, 0)
end
|
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb', line 124
def evaluate_the_current_input(
entry = @entry,
pointer = nil,
&block
)
_ = entry.text?
if _.end_with?('#')
yield if block_given?
end
end
|
#run ⇒ Object
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb', line 64
def run
create_skeleton_then_connect_skeleton
outer_vbox = padded_vbox
outer_vbox.add_hsep
grid = ui_padded_grid
grid.left( text('Input something, then input "#" as the last character → '))
@entry = entry
grid.hash_grid(
@entry,
left: 1,
top: 0,
xspan: 2,
yspan: 1,
hexpand: 1,
halign: 0.5,
vexpand: 1,
valign: 1
)
grid.hash_grid(
quit_button,
left: 1,
top: 1,
xspan: 1,
yspan: 1,
hexpand: 1,
halign: 0.5,
vexpand: 1,
valign: 1
)
@entry.on_changed {|something|
proc { |pointer|
evaluate_the_current_input(@entry, pointer) {
run_this_method_on_enter_key_event
}
}
}
outer_vbox.minimal(grid)
@window << outer_vbox
@window.intelligent_exit
end
|
#run_this_method_on_enter_key_event(entry = @entry) ⇒ Object
#
run_this_method_on_enter_key_event
#
113
114
115
116
117
118
119
|
# File 'lib/libui_paradise/examples/complex/030_entry_responds_to_comment_as_synonymous_to_the_enter_key_pressed_example.rb', line 113
def run_this_method_on_enter_key_event(
entry = @entry
)
entry.set_text(
entry.text?[0 .. -2].to_s
)
end
|