Problem with my Lisp

Started by mging63, November 16, 2010, 10:59:54 AM

Previous topic - Next topic

mging63

I try for many hours to solve this problem. I want to reset a checkbox in initialize and can't apply this. When i start my lisp, a message appear : insufficient number of arguments. I can't see what's appen.

This is my lisp:

(defun C:QD ( / )
(command "OPENDCL")
(dcl_Project_Load "Quickdraw")
(dcl_Form_Show Quickdraw_Pal)
(princ)
)
(defun c:QuickDraw_Pal_OnInitialize (Value /)
  (dcl_Control_SetValue QuickDraw_Pal_Top-Lt 0)
  (dcl_Control_SetValue QuickDraw_Pal_Top-Lt-1 0)
)

;Vue top-lt
(defun c:QuickDraw_Pal_Top-Lt_OnClicked (Value /)
  (setq Top-Lt1 (dcl_Control_Getvalue QuickDraw_Pal_Top-Lt))
)

(defun c:QuickDraw_Pal_Top-Lt-1_OnClicked (Value /)
  (setq Top-Lt-on (dcl_Control_Getvalue QuickDraw_Pal_Top-Lt-1))
)

(defun c:QuickDraw_Pal_OK_OnClicked (/)
  (dcl_Form_Close Quickdraw_Pal)
)

;|«Visual LISP© Format Options»
(80 2 50 2 nil "end of " 80 50 2 0 2 nil nil nil T)
;*** DO NOT add text below the comment! ***|;


My program is not finish, but i stop with this problem.

Another question: Is that the picture box control can turn gray when you click inside?

I'm a novice.

Thanks

BazzaCAD

None of your events should have a "Value" arguments passed to them:

(defun c:QuickDraw_Pal_OnInitialize (Value /)

(defun c:QuickDraw_Pal_Top-Lt_OnClicked (Value /)

(defun c:QuickDraw_Pal_Top-Lt-1_OnClicked (Value /)

Did you use the "Clipboard Copy" option from the Events tab to copy your code over?
They wouldn't be there if so...
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

BazzaCAD

To change a pic. box color to gray on click, you'd do something like this:

Code (autolisp) Select

(defun c:Untitled_Form1_PictureBox1_OnClicked (/)
  (dcl_Control_SetBackColor Untitled_Form1_PictureBox1 9)
)


See here for color options:
http://www.opendcl.com/HelpFiles/index.php?page=Reference/DataType/Color.htm
I used Acad color 9 or you may want to use something like -16 for the windows button face gray color...
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

mging63

The only arguments that have "Value" in my events is

(defun c:QuickDraw_Pal_Top-Lt-1_OnClicked (Value /)

I use "Clipboard copy" but i modify to test the problem.

I correct the lines and a message appear:

An OpenDCL function argument processing exception has occured!
Error: Invalis argument
Function: dcl_Control_Setvalue
Argument: 0

Property <Value> not found

owenwengerd

The error message means the control does not have a 'Value' property. Check the control name, and make sure you don't have multiple controls with the same name.
Owen Wengerd (Outside The Box) / ManuSoft

mging63

 ??? Ok, i work on my code and always arguments problems. I can't see what's appen.
There is my code:

(DEFUN C:QD (/)
  (COMMAND "OPENDCL")
  (DCL_PROJECT_LOAD "Quickdraw")
  (DCL_FORM_SHOW Quickdraw_Pal)
  (PRINC)
)
(setvar "cmdecho" 1)
(DEFUN c:QuickDraw_Pal_OnInitialize (/)
  (DCL_CONTROL_SETVALUE QuickDraw_Pal_Top-Lt 0)  ;reset control Top-Lt à OFF
  (DCL_CONTROL_SETVALUE QuickDraw_Pal_Top-Lt-1 0);reset chexbox Top-Lt-1 à OFF
  (DCL_CONTROL_SETVALUE QuickDraw_Pal_Top 0)     ;reset control Top à OFF
  (DCL_CONTROL_SETVALUE QuickDraw_Pal_Top-1 0)   ;reset chexbox Top-1 à OFF
)

;Vue top-lt
(DEFUN c:QuickDraw_Pal_Top-Lt_OnClicked (/)
  (SETQ Top-Lt1 (DCL_CONTROL_GETVALUE QuickDraw_Pal_Top-Lt))
  (dcl_Control_SetBackColor QuickDraw_Pal_Top-Lt -11)
)

(DEFUN c:QuickDraw_Pal_Top-Lt-1_OnClicked (/)
  (SETQ Top-Lt-on (DCL_CONTROL_GETVALUE QuickDraw_Pal_Top-Lt-1))
)

;Vue Top
(DEFUN c:QuickDraw_Pal_Top_OnClicked (/)
  (SETQ Top_1 (DCL_CONTROL_GETVALUE QuickDraw_Pal_Top))
  (if
    (= Top_1 1)
      (DCL_CONTROL_SETBACKCOLOR QuickDraw_Pal_Top 9)
      (DCL_CONTROL_SETBACKCOLOR QuickDraw_Pal_Top -6)
  )


(DEFUN c:QuickDraw_Pal_Top-1_OnClicked (/)
  (SETQ Top-1-on (DCL_CONTROL_GETVALUE QuickDraw_Pal_Top-1))
)

(DEFUN c:QuickDraw_Pal_OK_OnClicked (/)
  (DCL_FORM_CLOSE Quickdraw_Pal)
)

;|«Visual LISP© Format Options»
(80 2 50 2 nil "end of " 80 50 2 0 2 nil nil nil T)
;*** DO NOT add text below the comment! ***|;

owenwengerd

Look at each of your Clicked events in the events tab and compare those event handler function names to the functions in your code.  You will see that they do not match.  It also looks like some of them were originally added while the form was named "Form1".  You probably should reset event handler names via Tools -> Reset Event Names.

The SetValue problem is due to calling the function on a picturebox control, which does not have a Value property.  You probably intended to call it on the checkbox control instead.

Does that help?
Owen Wengerd (Outside The Box) / ManuSoft

mging63

After resetting my events and correct the code, always the same problem!

This is my last code.

owenwengerd

It looks like your code still has errors. There is no property name specified for (DCL_GETPROPERTY), and it looks like you are passing a picturebox control instead of a checkbox to (DCL_GETVALUE).
Owen Wengerd (Outside The Box) / ManuSoft

mging63

Is anyone can debug my lisp?

Thanks in advance.

owenwengerd

Attach your current .odcl and .lsp to a post, and I'm sure someone will help.
Owen Wengerd (Outside The Box) / ManuSoft

mging63


owenwengerd

I suggest you see if you can fix the code on your own.  Start by cleaning up the inconsistent naming in your .odcl file.  Select each control and remove the (VarName) override, then make sure the control's Name is uniform and consistent.  I have a feeling that the naming issues are a big part of your problems.

Once the names are corrected, choose Tools -> Reset Event Names and reset all controls, then save your file.  Next, copy and paste the event name for each event handler function to ensure your lisp uses the correct function name.  Next, fix the symbol name for each control in your lisp function calls (this should be very easy if you followed a uniform naming convention).

I hope this helps.
Owen Wengerd (Outside The Box) / ManuSoft

mging63

Thanks for your help. Fisr, I remove all (VarName) in my odcl. Second i reset Events. Third i copy events of all controls and past in my lisp file. I think that i've fix name of control. Still the problem. Sorry

Thanks

owenwengerd

Take a look at the attached version. Hopefully this gets you going in the right direction.
Owen Wengerd (Outside The Box) / ManuSoft