Added autofocus to edit dialogs first editline, added tab support for selecting next focusable element in edit dialogs, made valid? method be called in edit dialogs when fields change, simulator robot can now strafe side to side

This commit is contained in:
2021-02-11 09:28:04 -06:00
parent 3cc4c204a7
commit 75d6de0b00
6 changed files with 112 additions and 5 deletions

View File

@@ -7,7 +7,10 @@ module TAC
label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0
@name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0, autofocus: true
@name.subscribe(:changed) do |sender, value|
valid?
end
label "Comment", width: 1.0, text_align: :center
@comment = edit_line @options[:action] ? @options[:action].comment : "", width: 1.0

View File

@@ -8,7 +8,7 @@ module TAC
label "Name", width: 1.0, text_align: :center
@name_error = label "", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:name_filter), width: 1.0
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:name_filter), width: 1.0, autofocus: true
@name.subscribe(:changed) do |sender, value|
valid?

View File

@@ -9,7 +9,10 @@ module TAC
label "Name", width: 1.0, text_align: :center
@name_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@name_error.hide
@name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0
@name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0, autofocus: true
@name.subscribe(:changed) do |sender, value|
valid?
end
label "Type", width: 1.0, text_align: :center
@type_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@@ -24,6 +27,8 @@ module TAC
@value.show
@value_boolean.hide
end
valid?
end
@type ||= @var_type.value.to_sym
@@ -35,6 +40,10 @@ module TAC
@value = edit_line @options[:variable] ? @options[:variable].value : "", width: 1.0
@value_boolean = check_box "Boolean", checked: @options[:variable] ? @options[:variable].value == "true" : false
@value.subscribe(:changed) do |sender, value|
valid?
end
unless @options[:variable] && @options[:variable].type == :boolean
@value_boolean.hide
else