Parse variable to function reports as mouse event [Solved] [closed]

asked 2019-07-06 05:42:40 +0200

LSemmens gravatar image

updated 2019-07-06 10:18:38 +0200

ebot gravatar image

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
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by ebot
close date 2019-07-06 10:18:50.476643

Comments

Ignore this, there was nothing wrong with it, I set the wrong click event on the button. My own fault.

LSemmens gravatar imageLSemmens ( 2019-07-06 06:06:32 +0200 )edit