Dialog's no longer need a fixed height, misc. dialog tweaks.

This commit is contained in:
2020-09-09 09:52:44 -05:00
parent b811a83c60
commit df0d0df223
9 changed files with 42 additions and 35 deletions

View File

@@ -4,15 +4,15 @@ module TAC
def build
background Gosu::Color::GRAY
label "Name"
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 : "", width: 1.0
@name = edit_line @options[:action] ? @options[:action].name : "", filter: method(:name_filter), width: 1.0
label "Comment"
label "Comment", width: 1.0, text_align: :center
@comment = edit_line @options[:action] ? @options[:action].comment : "", width: 1.0
flow width: 1.0 do
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
close
end

View File

@@ -5,7 +5,7 @@ module TAC
background Gosu::Color::GRAY
label @options[:message]
button "Close", width: 1.0 do
button "Close", width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
close
end
end

View File

@@ -8,7 +8,7 @@ module TAC
background Gosu::Color::GRAY
label @options[:message]
flow width: 1.0 do
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
close
end

View File

@@ -5,18 +5,16 @@ module TAC
def build
background Gosu::Color::GRAY
flow width: 1.0 do
label "Name", width: 0.25
@name = edit_line @options[:renaming] ? @options[:renaming].name : "", filter: method(:filter), width: 0.70
end
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.subscribe(:changed) do |sender, value|
valid?
end
flow width: 1.0 do
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
close
end
@@ -67,10 +65,6 @@ module TAC
return true
end
end
def filter(text)
text.match(/[A-Za-z0-9._\- ]/) ? text : ""
end
end
end
end

View File

@@ -10,7 +10,7 @@ module TAC
@sound = Gosu::Sample.new(TAC::ROOT_PATH + "/media/error_alarm.ogg").play(1, 1, true)
button "Close", width: 1.0 do
button "Close", width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
close
end
end

View File

@@ -5,7 +5,7 @@ module TAC
background Gosu::Color::GRAY
@message_label = label $window.backend.tacnet.full_status
button "Close", width: 1.0 do
button "Close", width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
close
end

View File

@@ -6,12 +6,12 @@ module TAC
@type = @options[:variable].type if @options[:variable]
label "Name"
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 : "", width: 1.0
@name = edit_line @options[:variable] ? @options[:variable].name : "", filter: method(:name_filter), width: 1.0
label "Type"
label "Type", width: 1.0, text_align: :center
@type_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@type_error.hide
@@ -19,15 +19,17 @@ module TAC
@type = item
end
@type ||= @var_type.value.to_sym
@value_container = stack width: 1.0 do
label "Value"
label "Value", width: 1.0, text_align: :center
@value_error = label "Error", color: TAC::Palette::TACNET_CONNECTION_ERROR
@value_error.hide
@value = edit_line @options[:variable] ? @options[:variable].value : "", width: 1.0
@value_boolean = check_box "Variable", checked: @options[:variable] ? @options[:variable].value == true : false
end
flow width: 1.0 do
flow width: 1.0, margin_top: THEME_DIALOG_BUTTON_PADDING do
button "Cancel", width: 0.475 do
close
end
@@ -69,7 +71,7 @@ module TAC
if [:integer, :float, :double, :long].include?(@type)
if @value.value.strip.empty?
@value_error.value = "Error: Value cannot be blank\n or only whitespace."
@value_error.value = "Error: Numeric value cannot be\nblank or only whitespace."
@value_error.show
valid = false
@@ -108,7 +110,7 @@ module TAC
valid = false
else
@value_error.value = "Error: Type not set."
@value_error.value = "Error: Type not set or\ntype #{@var_type.value.inspect} is not valid."
@value_error.show
valid = false
end