What happened to me?

From Apache OpenOffice Wiki
Jump to: navigation, search


What happened to me?


There is no exact duplicate to the ME pseudo variable in VBA.

In MS Access VBA 'me' has attributes of two separate objects in OOoBasic: TextDocument and DataForm

The TextDocument object would be used for controlling the window size and placement on the screen for instance.

The DataForm meanwhile supports result set functions, such as First, Filter, InsertRow.

In AOO Basic the pseudo variable thisComponent normally would be the TextDocument, while thisComponent.DrawPage.Forms(0) meanwhile would reference the first DataForm owned by the TextDocument.

Perhaps a still closer equivalent is to use the object ownership hierarchy to get to the form. For example, if we had a single table form with a button, then in the macro called by the 'onClick' (or as AOO Base calls it the 'When initializing' event) we would do this: Create a macro in a library named onButtonClick( oEv as object )

    sub onButtonClick( oEv as object )
      ' oEv is the event object passed automatically
      ' it has a property SOURCE which is the 
      ' button that initiated this call
 
      dim oForm as variant
 
      oForm = oEv.Source.Model.Parent
       ' oForm is now the virtual form object
 
      dim oDocument as variant
 
      oDocument = thisComponent
       ' oDocument is now the textDocument displayed in
       ' the window on screen
 
    end sub
Personal tools