[Libreoffice-bugs] [Bug 143211] New: Better example macro
bugzilla-daemon at bugs.documentfoundation.org
bugzilla-daemon at bugs.documentfoundation.org
Tue Jul 6 10:30:58 UTC 2021
https://bugs.documentfoundation.org/show_bug.cgi?id=143211
Bug ID: 143211
Summary: Better example macro
Product: LibreOffice
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Documentation
Assignee: libreoffice-bugs at lists.freedesktop.org
Reporter: villeroy at t-online.de
CC: olivier.hallot at libreoffice.org
https://help.libreoffice.org/7.1/en-US/text/scalc/01/12120300.html?System=WIN&DbPAR=CALC&HID=modules/scalc/ui/erroralerttabpage/ErrorAlertTabPage#bm_id3156024
There are 3 levels of validation errors in Calc:
1) Stop (error box, reject entry)
2) Warn (warning box with No as default button)
3) Info (question box with Yes as default button)
In addition you can define a macro to handle failed validations. The documented
StarBasic definition
Function ExampleValidity(CellValue as String, TableCell as String)
has 2 flaws:
1) CellValue should be named CellFormula because the passed string is a formula
expression as entered into the formula bar (property "FormulaLocal").
2) The macro is declared as a function without a return value. In fact, the
entry is rejected when the macro function returns False and accepted in case of
True.
A better example macro looks like this:
Function ExampleValidity(CellFormula as String, TableCell as String)
Dim msg as string
Dim iAnswer as integer
Dim MB_FLAGS as integer
msg = "Invalid value: " & "'" & CellFormula & "'"
msg = msg & " in table: " & "'" & TableCell & "'"
msg = msg & Chr(10) & "Accept anyway?"
MB_FLAGS = MB_YESNO + MB_ICONEXCLAMATION + MB_DEFBUTTON2
iAnswer = MsgBox (msg , MB_FLAGS, "Error message")
ExampleValidity = (iAnswer = IDYES)
End Function
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210706/df535955/attachment.htm>
More information about the Libreoffice-bugs
mailing list