Calendar dropdown default date / view on Base form

LO 6.4.3.2-snap1, Ubuntu 18.04 with all updates.

I have a date field on a form with the drop-down enabled to show a date picker. The user selects the date and a list box is populated with events for that day. Simple…

Unless, that is, I want to set the default date to the current day. Many hours of research and fiddling drew a blank (unless I want to create a table field, update the field then bind the control to it - a tad OTT for the job in hand??)

The other thought I had was to have the Date Picker view as the default (as if the user had managed to find the tiny drop-down button to make the picker element visible) but I don’t seem able to get that to happen either!

Can anybody offer advice on how to use this control in an effective way?

EDIT
This is the code I’m using now, seems to get overwritten by the ‘default value’ of the control.

 sSql = format(date(), "DDDD DD MMM YYYY")
		
 getByName("dteMain").text = sSql

Hello,

Must admit being not clear on what you present. Will attempt an answer. Do not understand the code presented in the comment.

Created a simple form not attached to any tables. It has a push button to execute the macro (can be done in other ways - this just for test) and a date control (no drop down).

Here is the code used:

Sub Main
    Dim oForm as Object
    Dim oField as Object
    oForm = ThisComponent.Drawpage.Forms.getByName("Form")
    oField = oForm.getByName("dteMain")
    oField.Text = Format(Now(), "MM/DD/YY")
End Sub

and running the macro produces this:

image description

Strange this does not work if the drop down is enabled in the date control. Did find a way to get it to work by first moving a fixed text date into the field before the current date was moved in. Setting a default in the properties did not work. Modified sub:

Sub Main
    Dim oForm as Object
    Dim oField as Object
    oForm = ThisComponent.Drawpage.Forms.getByName("Form")
    oField = oForm.getByName("dteMain")
    oField.Text = "01/01/01"
    oField.Text = Format(Now(), "MM/DD/YY")
End Sub

Here is the control with drop down (not a tiny button here):

image description

This appears to be what you are asking for.

Thank you! Once again, Ratslinger, you have come to the rescue. Apologies for the slip-up with the code, I was trying to strip out the unnecessary bits and went a little too far… The code that works is below.


    With oFrm 
       '###	 Make sure 'Show Detail' button is disabled
    .getByName("btnCurrent").enabled = false
    '###	Put today's classes into the listbox
    .getbyname("dteMain").text="01/01/01"
     sSql = format(date(), "DDDD DD MMM YYYY")
    .getByName("dteMain").text = sSql
    end with

Apologies, I don’t seem able to get the formatted code tag to work properly…
Don’t understand why your dropdown button is bigger than the ones I see. Same happens with list / combo boxes. Just a sliver on the side, difficult to see if you don’t know it is there.

@HippySteve,

Glad all is good. Code makes more sense now.

As for button, try changing the Linux system Theme. Have customized in past and certain control selections produced things like very thin scroll bars & such.

Worth a try anyway.