[Solved] Set Datepicker default date to current date
[Solved] Set Datepicker default date to current date
Hello,
Is there a way to set the default date of a datepicker to the current date?
Thanks!
Is there a way to set the default date of a datepicker to the current date?
Thanks!
Last edited by raciret on Mon Jun 13, 2016 8:36 am, edited 2 times in total.
OpenOffice 4 on Windows 10
Re: Set Datepicker default date to current date
If this is a drop down list (aka Data Validity) and the Allow field is set for Cell Range, then simply put into a cell that is in the range.
If you have something else for your date picker, please provide more information so that we can determine other possibilities.
Code: Select all
=today() If you have something else for your date picker, please provide more information so that we can determine other possibilities.
OpenOffice 4.1.7, LibreOffice 7.0.1.2 on Windows 7 Pro, Ultimate & Windows 10 Home (2004)
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
Re: Set Datepicker default date to current date
I used a data control for the datepicker.
OpenOffice 4 on Windows 10
Re: Set Datepicker default date to current date
It is a List Box, or a Combo Box? Then you set the source to a cellrange, and you can put the = TODAY() formula into the cellrange...I used a data control for the datepicker.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Set Datepicker default date to current date
Thanks! I used the Date Field for the datepicker. does that formula apply to that as well?
OpenOffice 4 on Windows 10
Re: Set Datepicker default date to current date
I never used that 'Date Field' in the Calc. You can not insert a Writer-type 'Text Field' into a Spreadsheet. Do you mean the Formatted Field?I used the Date Field for the datepicker.
Or:
Can you upload your example .ods file here with the applied "datepicker"?
Is it a StarBasic/API related question?
Last edited by Zizi64 on Fri Jun 10, 2016 9:03 am, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Set Datepicker default date to current date
I have attached sample file of date picker.
Thank you!
Thank you!
- Attachments
-
- Date Picker.ods
- (11.19 KiB) Downloaded 356 times
OpenOffice 4 on Windows 10
Re: Set Datepicker default date to current date
OooopS!!!
I see now:
I see now:
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Set Datepicker default date to current date
I get a macro error massage, when I tried your file. There is not macro code in your example file...Date Picker.ods
Tibor Kovacs, Hungary; LO7.5.8/25.8.5.2 /Win7-10-11 x64Prof.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps: LO3.3.0-25.8.5.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Set Datepicker default date to current date
As always, this would be a perfect job for a database. Difficult to set up, easier to use and with no macro code.
Anyway: viewtopic.php?f=74&t=82181
Anyway: viewtopic.php?f=74&t=82181
Code: Select all
if isUnoStruct(objDateControl.getValue()) then
sType = "UNODATE" 'LibreOffice
else
sType = "INTDATE" 'OpenOffice
endif
basicDate = Now
vDate = ConvertDateTime(basicDate, sType)
objDateControl.setDate(vDate)| Edit: Sorry, the StarBasic language has no Today function. I replaced "Today" with "Now" |
Last edited by Villeroy on Thu Jun 16, 2016 2:47 pm, edited 2 times in total.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Set Datepicker default date to current date
Thanks Villeroy! I'm new to OpenOffice so I'll have to study this. But thank you!
Thanks, everyone for the help!
Thanks, everyone for the help!
OpenOffice 4 on Windows 10
Re: [Solved] Set Datepicker default date to current date
If your maro is supposed to run with OpenOffice only:
If you hate wrapper functions, the conversion from Basic Today into the right 8-digit integer goes like this:
Code: Select all
intDate = ConvertDateTime(Now, "INTDATE")
objDateControl.setDate(intDate)Code: Select all
intDate = cLng(Format(Year(Now), "0000") & Format(Month(Now), "00") & Format(Day(Now), "00"))
objDateControl.setDate(intDate)| Edit: Sorry, the StarBasic language has no Today function. I replaced "Today" with "Now" |
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice