OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: funkitect on October 27, 2010, 11:35:47 AM

Title: Version 5 Calendar Control
Post by: funkitect on October 27, 2010, 11:35:47 AM
Hello forum,

I'm using ODCL 5.1.2.3.

The calendar control look different than I remember from before.  I don't see "dcl_Calendar_SetCurSel" or "dcl_Calendar_GetCurSel" in the Control Browser.  I only see:

dcl_Control_GetProperty ccUtilShr_DatePicker_Calendar1 PropertyApiName [as String])

and

dcl_Control_SetProperty ccUtilShr_DatePicker_Calendar1 PropertyApiName [as String] NewValue [as Varies]


How do I find valid "PropertyApiName"?  The don't appear to be in the ODCL documentation.

Thanks,

James LeVieux
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 27, 2010, 12:16:12 PM
Hello, funkitect, there should be such information. Maybe the help file is missing? Then I recommend you to reinstall OpenDCL studio. And if there is sometimes no help available, you'll always find help here (http://www.opendcl.com/HelpFiles/index.php?&page=Index.htm).

Fred
Title: Re: Version 5 Calendar Control
Post by: owenwengerd on October 27, 2010, 12:16:45 PM
I don't have 5.1 installed to test, but it sounds like there's something missing.  I just checked the OpenDCL 6 control browser, and everything looks correct there.  If possible, I recommend to use OpenDCL 6 instead of 5.1.
Title: Re: Version 5 Calendar Control
Post by: funkitect on October 28, 2010, 09:51:35 AM
Hi Fred and Owen,

Thanks for your replies.  I wish I could use ver 6 but I haven't had time to figure out some issues with my ActiveX controls yet so I need to stick with ver 5 for now.  I looked at the help but only the "older" function names are listed (getCurSel and SetCurSel).  I am using Vista x64 so I loaded version 5.1.2.3 on my x86 machine and got the same results.  I dug up an older version 5.0.1.8 and got same result.

I took a look at the MasterDemo sample but the sample program Misc.lsp that demonstrates the calendar simply shows the calendar control and does not appear to use a Get or Set function.  Has anybody used the Calendar control in version 5?

James
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 28, 2010, 10:24:52 AM
Yes, we used it and it worked fine for us.

Fred
Title: Re: Version 5 Calendar Control
Post by: funkitect on October 28, 2010, 10:34:16 AM
Fred,

Do you mean you used the MasterDemo and it worked or that you used the Control Browser and the "working" functions (getCurSel and SetCurSel) were available?

James
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 28, 2010, 10:47:41 AM
Hi, this is a sample we used for a small date picker. We used it with Runtime 5.1.2.3.

Code (autolisp) Select

(defun TIME_PICKDATE (lstDate / lstErg
           c:general_sc_date_OnInitialize
           c:general_sc_date_OnCancelClose
           c:general_sc_date_pb_help
           c:general_sc_date_pb_cancel
           c:general_sc_date_pb_accept)
  (dcl_project_load "general")

  (if lstDate
    (progn
      (if (not (numberp (car lstDate))) (setq lstDate (mapcar 'atoi lstDate)))
      (setq lstDate (cons (float (car lstDate)) (cdr lstDate)))
    ); progn
    (setq lstDate (mapcar 'atoi (TIME_TO_LIST (getvar "CDATE")))
  lstDate (list (float (car lstDate)) (cadr lstDate) (caddr lstDate)))
  ); if

  (defun c:general_sc_date_OnInitialize ( /)
    (dcl_Month_SetCurSel general_sc_date_date lstDate)
  ); c:general_sc_date_OnInitialize

  (defun c:general_sc_date_OnCancelClose (bCancelling /)
    (if (= bCancelling 0) (setq lstErg (dcl_Month_GetCurSel general_sc_date_date)))
    nil
  ); c:general_sc_date_OnCancelClose

  (defun c:general_sc_date_pb_help ( /)
    (help "help.chm" "d_TIME_PICKDATE")
  ); c:general_sc_date_pb_help

  (defun c:general_sc_date_pb_cancel ( /)
    (setq lstErg nil)
    (dcl_form_close general_sc_date)
  ); c:general_sc_date_pb_cancel

  (defun c:general_sc_date_pb_accept ( /)
    (setq lstErg (dcl_Month_GetCurSel general_sc_date_date))
    (dcl_form_close general_sc_date)
  ); c:general_sc_date_pb_accept

  (dcl_form_show general_sc_date)

  (mapcar 'fix lstErg)
); TIME_PICKDATE

(defun TIME_TO_LIST (time / strTime)
  (setq strTime (rtos time 2 12))
  (setq strTime (mapcar '(lambda (x y / z) (repeat (- y (strlen (setq z (substr strTime x y))))
       (setq z (strcat z "0"))
     ); repeat
           z
   ) '(1 5 7 10 12 14) '(4 2 2 2 2 2)))
  strTime
); TIME_TO_LIST
Title: Re: Version 5 Calendar Control
Post by: funkitect on October 28, 2010, 11:33:48 AM
Thanks Fred,

I see the problem now.  I can use the functions "dcl_Month_SetCurSel" and "dcl_Month_SetCurSel"....Yay!  But those functions are not listed in the Help documentation.  The documentation lists "dcl_Calendar_SetCurSel" and "dcl_Calendar_SetCurSel" so that is incorrect.  The Control Browser does not appear to show any calendar specific functions at all...just generic control functions.

James
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 28, 2010, 11:48:18 AM
Hi, yes you are right, I can see it too, now. Which language have you installed? DEU or ENU?
Fred
Title: Re: Version 5 Calendar Control
Post by: funkitect on October 28, 2010, 12:11:07 PM
ENU is installed.

I was just testing a few things and this problem turns up:

If I pass a date 2009 or earlier like (2009 11 22)  to SetCurSel everything is fine.
If I pass a date after 2010 like (2010 11 22)  I get "Error: Expected more arguments".

What could be causing that?

James LeVieux
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 28, 2010, 12:17:42 PM
James, this is a wellknow problem. AutoCAD is misinterpreting the value 2010 as DXF code. Please use a float instead (2010.0).
That's why you see the line (mapcar 'fix lstErg) in my code.

Fred
Title: Re: Version 5 Calendar Control
Post by: Fred Tomke on October 28, 2010, 12:19:21 PM
See here for further details: http://www.opendcl.com/forum/index.php?topic=903.0 (http://www.opendcl.com/forum/index.php?topic=903.0)
Fred
Title: Re: Version 5 Calendar Control
Post by: funkitect on October 28, 2010, 12:25:29 PM
excellent!  I've never run into that before.

Thank you both for all you do!

James