dcl_Calendar_SetCurSel Return Value

Started by khann, March 24, 2010, 02:01:03 AM

Previous topic - Next topic

khann

Code (autolisp) Select

(setq *Inst_Day_Text "20100230")
(setq *YYYY (substr *Inst_Day_Text 1 4))
(setq *MM (substr *Inst_Day_Text 5 2))
(setq *DD (substr *Inst_Day_Text 7 2))

(setq *Temp_Date (list (read (strcat *YYYY ".0")) (read *MM) (read *DD)))

(setq *Chk_Date (dcl_Calendar_SetCurSel Calendar_form_calTemp *Temp_Date))



Hi,
The above is my test code of dcl_Calendar_SetCurSel to check the
*Inst_Day_Text is valid.

I need the T or nil return value but this returns ADS request error.
Someone help this, please.
Thanks.

Fred Tomke

Hi, don't use (list 2010 3 024) for date but (list 2010.0 3 24) for the date.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

Kerry

Fred
in the posted example *Temp_Date will evaluate to (2010.0 2 30), so I don't think that's the trouble.
Perfection is not optional.
My other home is TheSwamp

khann

Hi, Fred.

Yes. I did.

Code (autolisp) Select
(strcat *YYYY ".0")

I checked this list : (2010.0 2 30) .

I need the nil Return.

Fred Tomke

Quote from: Kerry Brown on March 24, 2010, 02:53:09 AM
in the posted example *Temp_Date will evaluate to (2010.0 2 30), so I don't think that's the trouble.

Sorry, my look was too short to recognize this. I'm just at a customer training.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

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

owenwengerd

Quote from: khann on March 24, 2010, 02:01:03 AM
I need the T or nil return value but this returns ADS request error.

The exception is by design. Since there are potentially other reasons why the function might return NIL, I don't think it's a good idea to use that function for the purpose of validating a date, however I'm open to other opinions.
Owen Wengerd (Outside The Box) / ManuSoft

khann

Hi.
I was coding Date Validation routine.
*Inst_Day_Text is 8 digit formatted user input string.

For checking leap year February's 29 day, I tried the
dcl_Calendar_SetCurSel .

Has got any better idea?

owenwengerd

It's a kludge, but you can do something like this:

Code (autolisp) Select
(defun ValidateDate (date / result)
  (dcl_suppressmessages T)
  (setq result (vl-catch-all-apply 'dcl_calendar_setcursel (list <CONTROL> date)))
  (dcl_suppressmessages NIL)
  result
)


You could also get fancy and use the ActiveX Windows date time picker control in a similar way.
Owen Wengerd (Outside The Box) / ManuSoft

khann

Thanks, it's so good.
And you tell me the usage of dcl_suppressmessages

But I wonder the Help page of "dcl_Calendar_SetCurSel "
-----------------------------------------------------------------------------------------------------
Syntax  :        (dcl_Calendar_SetCurSel form_Calendar Date [as Date])
Return Type  : Boolean (T if successful; otherwise NIL)
-----------------------------------------------------------------------------------------------------

If it fails why does not return NIL ?

owenwengerd

When a function throws an exception, it does not return.
Owen Wengerd (Outside The Box) / ManuSoft

khann