Class: FXSectionDialogBox

Inherits:
FXDialogBox
  • Object
show all
Defined in:
lib/IFMapper/FXSectionDialogBox.rb

Instance Method Summary collapse

Constructor Details

#initialize(map) ⇒ FXSectionDialogBox



17
18
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
# File 'lib/IFMapper/FXSectionDialogBox.rb', line 17

def initialize(map)
  decor = DECOR_TITLE|DECOR_BORDER|DECOR_CLOSE

  super( map.window, "Section Information", decor, 40, 40, 0, 0 )
  mainFrame = FXVerticalFrame.new(self,
        FRAME_SUNKEN|FRAME_THICK|
        LAYOUT_FILL_X|LAYOUT_FILL_Y)

  frame = FXHorizontalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  FXLabel.new(frame, "Name: ", nil, 0, LAYOUT_FILL_X)
  @name = FXTextField.new(frame, 40, nil, 0, LAYOUT_FILL_ROW)

  commentsframe = FXVerticalFrame.new(mainFrame, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)


  FXLabel.new(commentsframe, "Section Comments:", nil, 0, LAYOUT_FILL_X)
  @comments = FXText.new(commentsframe, nil, 0, LAYOUT_FILL_X)
  @comments.visibleRows = 4;
  @comments.visibleColumns = 32;

  frame = FXVerticalFrame.new(mainFrame, 
    LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y)


  @name.connect(SEL_CHANGED) { copy_to() }
  @comments.connect(SEL_CHANGED) { copy_to() }
  @map = map

  # We need to create the dialog box first, so we can use select text.
  create
end

Instance Method Details

#copy_from(section) ⇒ Object



11
12
13
14
15
# File 'lib/IFMapper/FXSectionDialogBox.rb', line 11

def copy_from(section)
  @name.text   = section.name.to_s
  @section = section
  @comments.text = section.comments
end

#copy_toObject



5
6
7
8
9
# File 'lib/IFMapper/FXSectionDialogBox.rb', line 5

def copy_to()
  @section.name  = @name.text
  @section.comments = @comments.text
  @map.update_title
end