https://issues.apache.org/ooo/show_bug.cgi?id=123669

            Bug ID: 123669
        Issue Type: DEFECT
           Summary: BASIC Variable Scopes
           Product: App Dev
           Version: 3.4.0
          Hardware: All
                OS: Windows 7
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: vba
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

two bugs ? , variable scope of BASIC

=================================================
1st
https://wiki.openoffice.org/wiki/Documentation/DevGuide/Basic/Variable_Scopes
The Private command is used to declare variables that can only be used locally
in a module. 

however,

>From the tests I've done, the module-level variables are always visible from
the outside of the module, whether  declared  public or private indifferently

es

' ModProvaScope
private m_private_str as string
public m_public_str as string

Public Sub ValorizzaModVars
m_private_str = " my_m_private_str "
m_public_str = " my_m_public_str "
end Sub


' ModProva
sub ProvaScope
call ValorizzaModVars
msgbox m_private_str ' " my_m_private_str "
msgbox m_public_str ' " my_m_public_str "
msgbox ModProvaScope.m_private_str ' " my_m_private_str "
msgbox ModProvaScope.m_public_str ' " my_m_public_str "
end Sub


==================================================
2nd
in oo BASIC is still possible to create a module-class
just write at the beginning of the module
option Compatible
option ClassModule

eg if the module is renamed ClsMyClass
by another module you can create the object with
set oMyClass = new ClsMyClass

the scope-bug is that the class is visible only to other modules in the same
workbook

for example, if I define the module-class in the [Macros].Standard then this
will no longer be visible from the inside of the modules of the worksheet
current open files

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.

Reply via email to