Class: Watobo::Gui::AddTableParmDialog

Inherits:
FXDialogBox
  • Object
show all
Defined in:
lib/watobo/gui/table_editor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(owner) ⇒ AddTableParmDialog



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/watobo/gui/table_editor.rb', line 19

def initialize(owner)
  #super(owner, "Edit Target Scope", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 425)
  super(owner, "Add Parameter", DECOR_ALL)

  @location = nil
  @pname = nil
  @pval = nil
  @param = nil

  base_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
  frame = FXHorizontalFrame.new(base_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)

  #  puts "create scopeframe with scope:"
  # @project.scope
  FXLabel.new(frame, "Location:")
  @location_combo = FXComboBox.new(frame, 5, nil, 0,
      COMBOBOX_STATIC|FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
  %w( WWWForm URL Cookie JSON ).each do |loc|
    item = @location_combo.appendItem(loc)
    @location_combo.setItemData(item, loc)
  end

  @location_combo.numVisible = 4
  @location_combo.numColumns = 8
  @location_combo.currentItem = 0
  @location_combo.editable = false
  #  @location_combo.connect(SEL_COMMAND, method(:onLocationChanged))

  FXLabel.new(frame, "Parameter:")
  @parm_name_dt = FXDataTarget.new('')
  FXTextField.new(frame, 15,
  :target => @parm_name_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)

  FXLabel.new(frame, "Value:")
  @parm_value_dt = FXDataTarget.new('')
  FXTextField.new(frame, 15,
  :target => @parm_value_dt, :selector => FXDataTarget::ID_VALUE,
  :opts => TEXTFIELD_NORMAL|LAYOUT_SIDE_RIGHT)

  buttons_frame = FXHorizontalFrame.new(base_frame,
  :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP)

  @finishButton = FXButton.new(buttons_frame, "Add" ,  nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT)
  @finishButton.enable
  @finishButton.connect(SEL_COMMAND) do |sender, sel, item|
  #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil)
    create_param
    self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
  end

  @cancelButton = FXButton.new(buttons_frame, "Cancel" ,
      :target => self, :selector => FXDialogBox::ID_CANCEL,
      :opts => BUTTON_NORMAL|LAYOUT_RIGHT)

end

Instance Attribute Details

#paramObject (readonly)

Returns the value of attribute param.



5
6
7
# File 'lib/watobo/gui/table_editor.rb', line 5

def param
  @param
end

Instance Method Details

#locationObject



7
8
9
# File 'lib/watobo/gui/table_editor.rb', line 7

def location()
  @location_combo.getItemData(@location_combo.currentItem)
end

#parmNameObject



11
12
13
# File 'lib/watobo/gui/table_editor.rb', line 11

def parmName()
  @parm_name_dt.value
end

#parmValueObject



15
16
17
# File 'lib/watobo/gui/table_editor.rb', line 15

def parmValue()
  @parm_value_dt.value
end