Bug 148129 - UNOControlDateField: Can't enable dropdown from macro code
Summary: UNOControlDateField: Can't enable dropdown from macro code
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2022-03-22 06:36 UTC by Michael Weghorn (away)
Modified: 2024-09-23 05:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
sample document with a macro (11.96 KB, application/vnd.oasis.opendocument.text)
2022-03-22 06:36 UTC, Michael Weghorn (away)
Details
Screenshot showing the dialog and relevant variables in the IDE (180.87 KB, image/png)
2022-03-22 06:37 UTC, Michael Weghorn (away)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn (away) 2022-03-22 06:36:08 UTC
Created attachment 179021 [details]
sample document with a macro

from Ilmari's email to dev mailing list [1]:

> The dev guide references some known issues (without bug numbers). I 
> appreciate any help in figuring out if they are still relevant.
> 
> https://wiki.documentfoundation.org/Documentation/DevGuide/LibreOffice_Basic#Date_Field
> Dropdown is currently not working by program, but you can set it with 
> the Control Properties in the IDE.

This still seems to be the case. Steps to reproduce:

1) open attached document "UnoControlDateField.odt"
2) run the macro

Actual behavior:
The left-hand date control has a dropdown menu to select the date, but the right-hand one doesn't.

For the left-hand one, the "Dropdown" property has been enabled in the dialog editor ("Tools" -> "Macros" -> "Organize Dialogs"). For the right-hand one, it was attempted in the macro, relevant part:

	REM This is false, as expected, since "Dropdown" not enabled in IDE
	test2 = oDateFieldControlModel2.DropDown
	REM This doesn't work, still doesn't show a dropdown
	oDateFieldControlModel2.DropDown = true
	REM This is still false
	test2 = oDateFieldControlModel2.DropDown


Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: a3a233657435e26dd9ff19d2d5087729e64cdb03
CPU threads: 12; OS: Linux 5.16; UI render: default; VCL: kf5 (cairo+xcb)
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded



[1] https://lists.freedesktop.org/archives/libreoffice/2022-March/088627.html
Comment 1 Michael Weghorn (away) 2022-03-22 06:37:15 UTC
Created attachment 179022 [details]
Screenshot showing the dialog and relevant variables in the IDE
Comment 2 Michael Weghorn (away) 2022-03-22 06:39:30 UTC
This here (see comment, and arrow indicating the line for DROPDOWN) in `UnoControl::ImplModelPropertiesChanged` *might* be relevant:

        sal_uInt16 nPType = GetPropertyId( rEvent.PropertyName );
        if ( mbDesignMode && mbDisposePeer && !mbRefreshingPeer && !mbCreatingPeer )
        {
            // if we're in design mode, then some properties can change which
            // require creating a *new* peer (since these properties cannot
            // be switched at existing peers)
            if ( nPType )
                bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER )
                            || ( nPType == BASEPROPERTY_MULTILINE )
->                          || ( nPType == BASEPROPERTY_DROPDOWN )
                            || ( nPType == BASEPROPERTY_HSCROLL )
                            || ( nPType == BASEPROPERTY_VSCROLL )
                            || ( nPType == BASEPROPERTY_AUTOHSCROLL )
                            || ( nPType == BASEPROPERTY_AUTOVSCROLL )
                            || ( nPType == BASEPROPERTY_ORIENTATION )
                            || ( nPType == BASEPROPERTY_SPIN )
                            || ( nPType == BASEPROPERTY_ALIGN )
                            || ( nPType == BASEPROPERTY_PAINTTRANSPARENT );
Comment 3 Xisco Faulí 2022-03-22 09:01:20 UTC
Reproduced in

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: f461c889ac4bc053c306537f644ec4bf3e0d5128
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

and according to https://wiki.documentfoundation.org/Documentation/DevGuide/LibreOffice_Basic#Date_Field this might be the case since OOo times
Comment 4 QA Administrators 2024-09-23 03:15:43 UTC Comment hidden (obsolete)
Comment 5 Michael Weghorn (away) 2024-09-23 05:43:15 UTC
Still reproducible with

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: e610847df369f02681603e34092fe7d39b749729
CPU threads: 32; OS: Linux 6.10; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: CL threaded