Yep, I see this on Linux as well. Nice little bug. You will notice that
it fails to compile.
Here is one hack / work around
dStart.year = oevent.source.context.getcontrol("test1").getdate().year
dStart.day = oevent.source.context.getcontrol("test1").getdate().day
dStart.month = oevent.source.context.getcontrol("test1").getdate().month
That said:
Are you just using a whole mess of global variables? For example:
ss = date
Later, you have this:
oevent.source.context.getcontrol("test1").date = cdatetounodate(date)
Now, the problem seems to be related to this not previously defined
variable "date". If you remove that, then your original macros works
without any other change. So, can you change your variable name from
date to something else?
On 02/27/2014 04:57 PM, Fernand Vanrie wrote:
Since 4.1 the Date property from a
"com.sun.star.awt.UnoControlDateFieldModel" returns no longer a
"Isodate" but a "Unodate".
Since its stay like that in 4.2 is started to correct all or BASIC
code who uses a "com.sun.star.awt.UnoControlDateFieldModel".
But i runed by accident in a bug where as soon we have a "ss = Date"
(who normaly returns today date as a string) the Date property of a
"com.sun.star.awt.UnoControlDateFieldModel" is corrupted with a BASIC
syntax error.
"Symbol date already defined differently"
as soon i left out the "ss = Date" the error disappeared
The error is not in 4.0
4.1 ?
The error is there in 4.2 under Windows all versions.
To reproduce the bug run the code below, who opens a dialog. The
dialog has a Datecontrol who can been filed with todays date using a
listener on the button.
Run the code and you run in the error
cancel the first row ("ss = date" ) to run without error
sub testDateError
ss = date
oDialogModel = createUnoService(
"com.sun.star.awt.UnoControlDialogModel" )
oDialogModel.PositionX = 10
oDialogModel.PositionY = 10
oDialogModel.Width = 100
oDialogModel.Height = 100
oDialogModel.Title = "test datecontrol"
oDialogControl = createUnoService(
"com.sun.star.awt.UnoControlDialog" )
oDialogControl.setModel( oDialogModel )
odialogModel = odialogcontrol.model
oDateModel = oDialogModel.createInstance(
"com.sun.star.awt.UnoControlDateFieldModel" )
oDateModel.PositionX = 20
oDateModel.PositionY = 20
oDateModel.Width = 40
oDateModel.Height = 14
oDateModel.dropdown = true
oDateModel.Name = "test1"
oDateModel.TabIndex = nNumControls
oDialogModel.insertByName( "test1", oDateModel )
oDateControl = oDialogControl.getControl( "test1" )
odialogModel = odialogcontrol.model
oButtonModel = oDialogModel.createInstance(
"com.sun.star.awt.UnoControlButtonModel" )
oButtonModel.PositionX = 40
oButtonModel.PositionY = 70
oButtonModel.Width = 60
oButtonModel.Height = 14
oButtonModel.Name = "pressbuton"
oButtonModel.Label = "press to fill with date"
oDialogModel.insertByName( "pressbuton", oButtonModel )
oButtonControl = oDialogControl.getControl( "pressbuton" )
oActionListener = CreateUnoListener("pressbuton" + "_",
"com.sun.star.awt.XActionListener" )
oButtonControl.addActionListener( oActionListener )
oDialogcontrol.setVISIBLE(true)
oDialogcontrol.execute()
end sub
sub pressbuton_actionPerformed( oEvent As com.sun.star.awt.ActionEvent )
oevent.source.context.getcontrol("test1").date = cdatetounodate(date)
dim dStart as New com.sun.star.util.Date
dStart.year = oevent.source.context.getcontrol("test1").date.year
dStart.day = oevent.source.context.getcontrol("test1").date.day
dStart.month = oevent.source.context.getcontrol("test1").date.month
end sub
Sub Main
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.