https://bugs.freedesktop.org/show_bug.cgi?id=87974

            Bug ID: 87974
           Summary: Base does not appear to execute Sub Main or allocate
                    GLOBAL variables.
           Product: LibreOffice
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: blocker
          Priority: medium
         Component: Database
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 111660
  --> https://bugs.freedesktop.org/attachment.cgi?id=111660&action=edit
Entire test database that can demonstrate the issue

Base reports Version: 4.1.6.2, Build ID 4.1.6.2-7.fc19

While attempting to solve a problem, I installed Xray. 
After altering Sub Main as follows:
   Sub Main
   Xray ThisComponent
   End Sub
I noticed it wasn't available, so I manually loaded it and continued on to
solve my original problem. Xray works as long as I manually load it, but that
indicates that Sub Main isn't functioning as expected.

I further modified my code as follows:
Option Explicit

Global defaultDate           as string
Global defaultVendor         as string

Sub Main
Xray ThisComponent

defaultDate = Date
defaultVendor = "Eldons"
End Sub




Sub PriorToReset(event)
dim Form
dim DateField
MsgBox ("defaultVendor = " + defaultVendor)
if defaultDate = "" then
   defaultDate = Date
   defaultVendor = ""
end if
MsgBox ("defaultDate = " + defaultDate)
Form=event.source
DateField = Form.getByName("Date")

Xray DateField

if DateField.getPropertyValue("Text") = "" then
   DateField.setPropertyValue("Text", "01/03/2015")
   'DateField.Text = Date
   MsgBox (DateField.getPropertyValue("Text"))
   Xray DateField
else
   defaultDate = DateField.Text
end if
End Sub

This consistently shows that the Globals don't exist and/or that Main is not
executing because my defaultVendor is always a null string on inspection. Even
removing all references to Xray shows that the globals are never initialized
via Sub Main.

Attached is the entire database.

If your testing environment has Xray available, then the code can run as is. If
not, please comment out all references to Xray.

To demonstrate the bug, start Base using the attached database, go to Forms and
execute the Inventory form. Immediately go to the last record via >| and then
attempt to go beyond it to next record via > to cause the PriorToReset sub to
execute. The first MsgBox always displays a null string as the defaultVendor
value when that global is supposedly explicitly set to a value via the Sub
Main. Ignore all the rest of the code and results as it's testing code for a
different issue.
The first MsgBox not displaying the contents of the Global shows that either
there is no global or it exists but Sub Main is not being executed to
initialize the global.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to