Class: Watobo::Gui::EditCommentDialog

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

Instance Method Summary collapse

Constructor Details

#initialize(owner, chat) ⇒ EditCommentDialog

Returns a new instance of EditCommentDialog.



9
10
11
12
13
14
15
16
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
# File 'lib/watobo/gui/edit_comment.rb', line 9

def initialize(owner, chat)
  #super(owner, "Edit Target Scope", DECOR_TITLE|DECOR_BORDER, :width => 300, :height => 425)
  super(owner, "Edit Comment - Chat #{chat.id}", DECOR_ALL, :width => 300, :height => 150)

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

  #  puts "create scopeframe with scope:"
  # @project.scope
  text_frame = FXVerticalFrame.new(base_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_SUNKEN|FRAME_THICK, :padding => 0)
  @textbox = FXText.new(text_frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
  @textbox.setText(chat.comment)
  @textbox.setFocus()
  @textbox.setDefault()

  @textbox.connect(SEL_KEYPRESS) { |sender, sel, event|
    if event.code == KEY_Tab
    @finishButton.setFocus()
    @finishButton.setDefault()
    true
    else
    false
    end

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

  @finishButton = FXButton.new(buttons_frame, "Accept" ,  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)
    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 Method Details

#commentObject



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

def comment()
  @textbox.to_s
end