Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index

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 = 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 "" 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 "".

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 "" 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( "" )
   oDialogModel.PositionX = 10
   oDialogModel.PositionY = 10
   oDialogModel.Width = 100
   oDialogModel.Height = 100
   oDialogModel.Title = "test datecontrol"
oDialogControl = createUnoService( "" )
   oDialogControl.setModel( oDialogModel )
   odialogModel = odialogcontrol.model
oDateModel = oDialogModel.createInstance( "" )
   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( "" )
   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" + "_", "" )
   oButtonControl.addActionListener( oActionListener )

end sub
sub pressbuton_actionPerformed( oEvent As )

 oevent.source.context.getcontrol("test1").date = cdatetounodate(date)
dim dStart as New
dStart.year = oevent.source.context.getcontrol("test1").date.year = oevent.source.context.getcontrol("test1")
dStart.month = oevent.source.context.getcontrol("test1").date.month
end sub

Sub Main

Andrew Pitonyak
My Macro Document:

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


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.