Direct Access to Objects

The code examples above have all shown objects being accessed using methods like getText() or setValue(). From Rekall version 2.3.3, it is possible to access objects in a rather simpler manner.

For instance, to set the current value of a control you might write something as below (for the onClick button event):

def eventFunc (button) :
    qrow  = button.getBlock().getQueryRow()
    field = button.getNamedCtrl("../myfield")
    field.setValue (qrow, "Rekall R00lz")
      

This can be written rather more quickly as:

def eventFunc (button) :
    button.__block__.myfield.value = "Rekall R00lz"
      

Lets pick this appart. The __block__ term is treated as a property of the button which accesses the block in which the button is embedded; in fact, __block__ will do this for any control or object (even for a block, where it will get the parent block). Then, because myfield is not recognised as a known property of a block, Rekall looks to see if the block has a child object named myfield, which returns the appropriate control. Lastly, value accesses the fields value, which is set to Rekall R00lz. Note that this sets the value for the current row; if you want to access another row then you still have to use the setValue() method. value can be read as well as written, so we could copy a value from one field to another by:

def eventFunc (button) :
    button.__block__.myfield1.value = button.__block__.myfield2.value
      

The full list of such properties appears in the appendix which lists the object methods (which is half-way logical since, for example, setValue is also property of a control which just happens to be a function that can be called to set the control's value).