I am attempting to call a subroutine as below. If I watch the variable “Number” in the OpenFormImage routine it reports as a mouse event
com.sun.star.awt.MouseEvent
The sub openMainImage is called by a “Mouse button released” event on a button in the main form. As there are several images on the main form I am attempting to make the OpenFormImage event as generic as possible hence the call to the subroutine.
Begs the question. What am I doing wrong?
The original Sub OpenFormImage before setting it up as a called routine works flawlessly. It is only, now that I attempting to validate the input from the calling routine that I run into strife.
Sub openMainImage
OpenFormImage(1)
End Sub
Sub openVariantImage
OpenFormImage(2)
Endsub
Sub OpenFormImage(Number)
Dim oForm 'Reference to the form containing the primary record.
Dim oSubForm 'Reference to the subform containing the data
REM Get the button's view model from the event Source.
REM Get the button's data model from the view model.
REM Get the form from the data model.
oForm = ThisComponent.DrawPage.Forms.getByIndex(0) ' Main Form
oSubForm = oForm.GetByName("Stamp") ' SubForm Name
Dim sSG
Dim lSG
REM Find the column that contains the NAME field.
If Number = 3 then
lSG = oSubForm.findColumn("SM_VARIANT")
Elseif Number= 2 then
lSG = oSubForm.findColumn("SM_WATERMARK")
ELse
lSG = oSubForm.findColumn("SM_IMAGE")
End If
REM Get the data for the current record.
sSG = oSubForm.getString(lSG)
sSG = "/home/leigh/Documents/Stamps/" & sSG
REM Open the window
Shell "pix " & sSG
End Sub