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.



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/watobo/gui/define_scope_frame.rb', line 155

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.



138
139
140
# File 'lib/watobo/gui/define_scope_frame.rb', line 138

def details
  @details
end

Instance Method Details

#onAccept(sender, sel, event) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/watobo/gui/define_scope_frame.rb', line 142

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