maildev@lists.thunderbird.net

Thunderbird email developers

View all threads

How to get datepicker and timepicker in XUL in TB68

JK
Jonathan Kamens
Sun, Mar 31, 2019 11:57 AM

Yes, please. ;-) Thanks.

On 3/31/19 7:22 AM, Magnus Melin wrote:

Let's actually fix that in code
https://bugzilla.mozilla.org/show_bug.cgi?id=1540522. Creating a
menulist by code is enough to trigger the creation so it's available.

Fixing <input type="date"> and <input type="time"> is hopefully also
on the horizon for 68.

 -Magnus

On 31-03-2019 09:54, Geoff Lankow wrote:

Wow, that I've never seen that is a coincidence. It seems that the
script to create the menulist custom element is only loaded if there
is a menulist
https://searchfox.org/mozilla-central/rev/73e1da0906e711285c15b0fa5472263c01cbd3f2/toolkit/content/customElements.js#523.
All the places where we have datepickers also have one or more menulists.

I guess the easiest way to deal with that is to put
chrome://global/content/elements/menulist.js in a script tag if your
document doesn't have a menulist.

GL

On 31/03/19 16:14, Jonathan Kamens via Maildev wrote:

OK, this is /very weird/.

The following XUL file successfully displays a datepicker and
timepicker in the 2019-03-29 nightly build:

<?xml version="1.0"?> <?xml-stylesheet type="text/css" href="chrome://global/skin/global.css"?> <?xml-stylesheet type="text/css" href="chrome://calendar/content/widgets/calendar-widget-bindings.css"?> <?xml-stylesheet type="text/css" href="chrome://lightning-common/skin/datetimepickers.css"?> <?xml-stylesheet type="text/css" href="chrome://messenger/skin/menulist.css"?>

<page align="start" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox>
<menulist> </menulist>
</hbox>
<hbox align="baseline">
<label value="Date:"/>
<datepicker/>
<label value="Time:"/>
<timepicker/>
</hbox>
<script type="application/javascript" src="chrome://calendar/content/calendar-ui-utils.js"/>
<script type="application/javascript" src="chrome://messenger/content/customElements.js"/>
<script type="application/javascript" src="chrome://calendar/content/datetimepickers/datetimepickers.js"/>
</page>

However, if I remove the two lines shown in red, the datepicker and
timepicker no longer display correctly.

wut?

  jik

Yes, please. ;-) Thanks. On 3/31/19 7:22 AM, Magnus Melin wrote: > > Let's actually fix that in code > <https://bugzilla.mozilla.org/show_bug.cgi?id=1540522>. Creating a > menulist by code is enough to trigger the creation so it's available. > > Fixing <input type="date"> and <input type="time"> is hopefully also > on the horizon for 68. > >  -Magnus > > On 31-03-2019 09:54, Geoff Lankow wrote: >> >> Wow, that I've never seen that is a coincidence. It seems that the >> script to create the menulist custom element is only loaded if there >> is a menulist >> <https://searchfox.org/mozilla-central/rev/73e1da0906e711285c15b0fa5472263c01cbd3f2/toolkit/content/customElements.js#523>. >> All the places where we have datepickers also have one or more menulists. >> >> I guess the easiest way to deal with that is to put >> chrome://global/content/elements/menulist.js in a script tag if your >> document doesn't have a menulist. >> >> GL >> >> On 31/03/19 16:14, Jonathan Kamens via Maildev wrote: >>> >>> OK, this is /very weird/. >>> >>> The following XUL file successfully displays a datepicker and >>> timepicker in the 2019-03-29 nightly build: >>> >>> <?xml version="1.0"?> >>> <?xml-stylesheet type="text/css" href="chrome://global/skin/global.css"?> >>> <?xml-stylesheet type="text/css" href="chrome://calendar/content/widgets/calendar-widget-bindings.css"?> >>> <?xml-stylesheet type="text/css" href="chrome://lightning-common/skin/datetimepickers.css"?> >>> <?xml-stylesheet type="text/css" href="chrome://messenger/skin/menulist.css"?> >>> >>> <page align="start" >>> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> >>> <hbox> >>> <menulist> </menulist> >>> </hbox> >>> <hbox align="baseline"> >>> <label value="Date:"/> >>> <datepicker/> >>> <label value="Time:"/> >>> <timepicker/> >>> </hbox> >>> <script type="application/javascript" >>> src="chrome://calendar/content/calendar-ui-utils.js"/> >>> <script type="application/javascript" >>> src="chrome://messenger/content/customElements.js"/> >>> <script type="application/javascript" >>> src="chrome://calendar/content/datetimepickers/datetimepickers.js"/> >>> </page> >>> >>> However, if I remove the two lines shown in red, the datepicker and >>> timepicker no longer display correctly. >>> >>> wut? >>> >>>   jik >>> >> >> _______________________________________________ >> Maildev mailing list >> Maildev@lists.thunderbird.net >> http://lists.thunderbird.net/mailman/listinfo/maildev_lists.thunderbird.net > > _______________________________________________ > Maildev mailing list > Maildev@lists.thunderbird.net > http://lists.thunderbird.net/mailman/listinfo/maildev_lists.thunderbird.net