Bug 134504 - Editing Base Public and Private variables not working
Summary: Editing Base Public and Private variables not working
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.4.4.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-04 16:07 UTC by tj_trevor.jones
Modified: 2024-11-05 03:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Form with 2 buttons (10.74 KB, application/vnd.oasis.opendocument.database)
2020-07-20 18:30 UTC, tj_trevor.jones
Details
the document that works expectedly (10.72 KB, application/vnd.oasis.opendocument.text)
2020-07-20 18:42 UTC, himajin100000
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tj_trevor.jones 2020-07-04 16:07:39 UTC
Description:
No value can be assigned to a variable defined as public or private.

Steps to Reproduce:
1.Create a form with 2 Buttons
2.Define the following macros

OPTION EXPLICIT

Public  VarI AS Integer
Private VarS AS String

Sub Button1

MsgBox VarI
MsgBox VarS

VarI = 1
VarS = "One"

End Sub

Sub Button2

MsgBox VarI
MsgBox VarS

VarI = 2
VarS = "Two"

End Sub

3. Assign Each macro to the execute action of the appropriate button
4. Run the form and click each button alternately.

Actual Results:
MsgBox for VarI always displays 0
MsgBox for VarS always displays blank.


Expected Results:
MsgBox for VarI should alternately display 1 then 2
MsgBox for VarS should alternately display "One" then "Two"



Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.4.2
Build ID: 1:6.4.4~rc2-0ubuntu0.18.04.1
CPU threads: 3; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-US
Calc: threaded

This release was supplied by The Document Foundation, Debian and Ubuntu.
Copyright © 2000–2020 LibreOffice contributors.
LibreOffice was based on OpenOffice.org.
Comment 1 himajin100000 2020-07-19 11:24:20 UTC
1. What happens if you declare the variables VarI and VarS as "Global" instead of "Public" or "Private"
2. What happens if you add "Option VBASupport 1" to the code and keep the variables "Public" and "Private"?

I believe that variables declared with "Public" and "Private" under "Option VBASupport 0"(default) are not PersistentGlobal

https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.cxx?r=5f19287a#215

https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.cxx?r=5f19287a#220
Comment 2 Xisco Faulí 2020-07-20 15:01:10 UTC
(In reply to himajin100000 from comment #1)
> 1. What happens if you declare the variables VarI and VarS as "Global"
> instead of "Public" or "Private"
> 2. What happens if you add "Option VBASupport 1" to the code and keep the
> variables "Public" and "Private"?
> 
> I believe that variables declared with "Public" and "Private" under "Option
> VBASupport 0"(default) are not PersistentGlobal
> 
> https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.
> cxx?r=5f19287a#215
> 
> https://opengrok.libreoffice.org/xref/core/basic/source/comp/dim.
> cxx?r=5f19287a#220

Putting to NEEDINFO until the reporter comes back with feedback
Comment 3 tj_trevor.jones 2020-07-20 18:25:39 UTC
With variables declared as Global it works fine. VarI displays 1 then 2. VarS displays "one" then "two".

With "Option VBASupport 1" declared and the variables "Public" and "Private" 0 and space are displayed as before.
Comment 4 tj_trevor.jones 2020-07-20 18:30:12 UTC
Created attachment 163333 [details]
Form with 2 buttons

OPTION EXPLICIT
Option VBASupport 1

Public  VarI AS Integer
Private VarS AS String

Sub Button1

MsgBox VarI
MsgBox VarS

VarI = 1
VarS = "One"

End Sub

Sub Button2

MsgBox VarI
MsgBox VarS


VarI = 2
VarS = "Two"

End Sub
Comment 5 himajin100000 2020-07-20 18:42:20 UTC
Created attachment 163334 [details]
the document that works expectedly
Comment 6 himajin100000 2020-07-20 18:45:27 UTC
Reproduced.

It seems Base Forms works differently than odt.

minor note: the document attached by the buttons in the reproters macro uses Application macro, not Document Macro.
Comment 7 himajin100000 2020-07-20 18:46:23 UTC
typo

minor note: the buttons in the document attached by the reproter uses Application macro, not Document Macro.
Comment 8 QA Administrators 2022-07-21 03:33:53 UTC Comment hidden (obsolete)
Comment 9 Alex Thurgood 2022-07-21 05:33:46 UTC
Bug still present in 

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 8b82a71013567e148166b514d0ce0f5905f5a3e3
CPU threads: 8; OS: Mac OS X 12.4; UI render: default; VCL: osx
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: threaded
Comment 10 Alex Thurgood 2022-07-21 05:50:10 UTC
(In reply to Alex Thurgood from comment #9)
> Bug still present in 
> 
> Version: 7.5.0.0.alpha0+ / LibreOffice Community
> Build ID: 8b82a71013567e148166b514d0ce0f5905f5a3e3
> CPU threads: 8; OS: Mac OS X 12.4; UI render: default; VCL: osx
> Locale: fr-FR (fr_FR.UTF-8); UI: en-US
> Calc: threaded

If I include

Option VBASupport 1

and leave the Private and Public declarations,
 
it behaves in a manner I don't understand.

- clicking on Button 1 a first time after opening the form reproduces the bug and displays 0 and an empty MsgBox;

- clicking on Button 2 a first time then displays the values "1" and "One" respectively;

- subsequently clicking on Button 1 again, i.e. a second time, displays "2" and "Two".
Comment 11 QA Administrators 2024-11-05 03:16:00 UTC
Dear tj_trevor.jones,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug