Bug 95523 - fake argument when launching a macro from custom toolbar
Summary: fake argument when launching a macro from custom toolbar
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.3.7.2 release
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-02 13:35 UTC by Anthony ORGER
Modified: 2015-11-02 16:11 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony ORGER 2015-11-02 13:35:33 UTC
Hello.

I got a problem with optional argument when I launch a macro from custom toolbar button.

From toolbar, like from menu, the argument must be missing. It's OK from custom menu but not from custom toolbar. In case I use toolbar, the argument is always '0'.

LibreOffice tested versions : 4.3.7.2  (both OS windows 7 sp1 and Ubuntu 14.04 LTS); 4.4.5.2 (w7); 5.0.2.2 (w7).


Exemple (code):
«
'Saving a file called as "TestName".
Sub Save_Test_File(optional TestName as String)
IF isMissing(TestName) THEN
	TestName = inputbox("Test name, please?")
END IF
IF TestName="" THEN	TestName = "in progress"
msgbox("Test Name = " & TestName)

'[saving]
end sub
»

If I spell form a custom menu, an inputbox appears, then a message box displays the "Test Name".
With a custum toolbar button, a message box directly displays "Test Name = 0".

The "patch" I found is spelling through another macro without argument just calling the first.
Exemple :
«
Sub Save_Test_File_Button
  Save_Test_File()
End sub
»
Comment 1 Maxim Monastirsky 2015-11-02 14:19:11 UTC
Hi,

It isn't a "fake" argument, but the key modifier you press while clicking the toolbar button. Try holding CTRL or SHIFT and you'll see it won't be 0. It's a feature AFAIK...
Comment 2 Anthony ORGER 2015-11-02 16:11:58 UTC
Hi.

Ok. It's not always 0.
"Test Name = 8192" with CTRL while clicking.
"Test Name = 4096" with Shift while clicking.

« It's not a bug, it's a feature!» So,I must deal with.

Thank you Maxim Monastirsky for your quick answer.