Class: RFormUnit::BaseControl

Inherits:
Object
  • Object
show all
Includes:
Driver
Defined in:
lib/rformunit/control.rb

Direct Known Subclasses

Button, CheckBox, ComboBox, Label, ListView, RadioButton, Tab, TextBox, Window

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Driver

#close_window, #driver, #focus_window, #init, #key_press, #open_file_dialog, #set_autoit_option, #wait_and_focus_window, #wait_for_window, #window_exists?

Constructor Details

#initialize(win, ctrl_id) ⇒ BaseControl

Returns a new instance of BaseControl.



9
10
11
12
# File 'lib/rformunit/control.rb', line 9

def initialize(win, ctrl_id)
  @parent_win = win
  @control_id = ctrl_id
end

Instance Attribute Details

#control_idObject

Returns the value of attribute control_id.



7
8
9
# File 'lib/rformunit/control.rb', line 7

def control_id
  @control_id
end

#parent_winObject

Returns the value of attribute parent_win.



7
8
9
# File 'lib/rformunit/control.rb', line 7

def parent_win
  @parent_win
end

Instance Method Details

#clickObject



40
41
42
# File 'lib/rformunit/control.rb', line 40

def click
  driver.ControlClick(@parent_win.title, @parent_win.text, @control_id)
end

#focusObject



26
27
28
# File 'lib/rformunit/control.rb', line 26

def focus
  driver.ControlFocus(@parent_win.title, @parent_win.text, @control_id)
end

#get_textObject



22
23
24
# File 'lib/rformunit/control.rb', line 22

def get_text
  driver.ControlGetText(@parent_win.title, @parent_win.text, @control_id)
end

#is_enabled?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'lib/rformunit/control.rb', line 30

def is_enabled?
  ret = driver.ControlCommand(@parent_win.title, @parent_win.text, @control_id, "IsEnabled" ,"")
  ret == 1 or ret == "1"
end

#is_visible?Boolean

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/rformunit/control.rb', line 35

def is_visible?
  ret = driver.ControlCommand(@parent_win.title, @parent_win.text, @control_id, "IsVisible" ,"")
  ret == 1 or ret == "1"
end

#send_text(text) ⇒ Object



18
19
20
# File 'lib/rformunit/control.rb', line 18

def send_text(text)
  driver.ControlSend(@parent_win.title, @parent_win.text, @control_id, text)
end

#set_text(new_text) ⇒ Object



14
15
16
# File 'lib/rformunit/control.rb', line 14

def set_text(new_text)
  driver.ControlSetText(@parent_win.title, @parent_win.text, @control_id, new_text)
end