dcl_Calendar_SetCurSel behaviour.

Started by mr nick, September 04, 2009, 07:14:03 AM

Previous topic - Next topic

mr nick

I have a dialog with a calendar control on it and I want the dialog to open with a date preselected. This works just fine if I use a date within 2009 like this:

  (setq ndate '(2009 12 31))
  (dcl_Calendar_SetCurSel date_date_calendar1 ndate)

But as soon as I try and use a date from 2010 I get an 'Expected more arguments' error:

  (setq ndate '(2010 01 01))
  (dcl_Calendar_SetCurSel date_date_calendar1 ndate)

Is there something else I need to do in order to get the calendar to select a date beyond the end of the year or is this a bug?

owenwengerd

This is due to a bug in the way AutoCAD handles list arguments that look like DXF group codes. It tries to interpret the '(2010 1 1) as a DXF group, and fails -- then deals with the failure by calling the SetCurSel function with no arguments. The SetCurSel function then triggeres the OpenDCL argument exception because it expects an argument.

Since the argument never gets to OpenDCL, there is no way to fix it other than from the lisp side. The workaround is to make the first element of the list a floating point number instead of an integer so that AutoCAD doesn't interpret it as a DXF code. For example, the following works:
(dcl_Calendar_SetCurSel date_date_calendar1 '(2010.0 1 1))
Owen Wengerd (Outside The Box) / ManuSoft

mr nick

Thanks a lot Owen. Easy when you know how  ;D

Fred Tomke

@Owen: Shall we add this behavior to the Online help?
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Yes, perhaps in DataType\Date.htm. The issue applies generally to any argument, but color and date are common cases.
Owen Wengerd (Outside The Box) / ManuSoft