Class: Watobo::Gui::EditScopeDetailsDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Responder
Defined in:
lib/watobo/gui/define_scope_frame.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner, details) ⇒ EditScopeDetailsDialog

Returns a new instance of EditScopeDetailsDialog.



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/watobo/gui/define_scope_frame.rb', line 176

def initialize(owner, details)
  
  super(owner, "Scope Details", 
  :opts => DECOR_TITLE|DECOR_BORDER|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 350, :height => 500)
  
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
  
  @details = (details.is_a? Hash) ? details : Hash.new
  
  @root_path = FXDataTarget.new('')
  main_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X|FRAME_NONE, :padding => 0)
  @scopeDetailsFrame = ScopeDetailsFrame.new(main_frame, details)
  
  button_frame = FXHorizontalFrame.new(main_frame, :opts => LAYOUT_FILL_X)
  accept = FXButton.new(button_frame, "&Accept", nil, self, ID_ACCEPT,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
  accept.enable
  # Cancel
  FXButton.new(button_frame, "&Cancel", nil, self, ID_CANCEL,
  FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



159
160
161
# File 'lib/watobo/gui/define_scope_frame.rb', line 159

def details
  @details
end

Instance Method Details

#onAccept(sender, sel, event) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/watobo/gui/define_scope_frame.rb', line 163

def onAccept(sender, sel, event)
  @details = @scopeDetailsFrame.getDetails()
  root_path_ok, *error = Watobo::Utils.checkRegex(@details[:root_path])
  if root_path_ok == true
    getApp().stopModal(self, 1)
    self.hide()
    return 1
  else
    FXMessageBox.information(self, MBOX_OK, "Wrong Root Path Format", "Root Path must be a Regex!!!\nError: #{error.join('\n')}")
  end
  
end