Method: AimsProject::GeometryEditor#select_atom

Defined in:
lib/aims_project/geometry_editor.rb

#select_atom(atom) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/aims_project/geometry_editor.rb', line 87

def select_atom(atom)
  selectionStyle = Wx::RichTextAttr.new(Wx::BLACK, Wx::Colour.new("YELLOW"))
  
  pattern = atom.format_geometry_in
  puts "GeometryEditor.select_atom: pattern=#{pattern}"

  matchdata = self.text_ctrl.get_text.match(pattern)
  if matchdata
    lineStart = matchdata.begin(0)
    lineEnd = matchdata.end(0)
    # self.text_ctrl.set_style(lineStart...lineEnd, selectionStyle)
    self.text_ctrl.goto_pos(lineStart)
    self.text_ctrl.set_selection_start(lineStart)
    self.text_ctrl.set_selection_end(lineEnd)
  end
end