Jump to content

DCL Radio Button


mousho

Recommended Posts

hi friends.

i need help with dcl radio button

what i need to change that the last radio button that i checked remain selected if i load the lisp again

it alwayes check the "HOOPC" radio button

 

DCL:

       :boxed_radio_row {					//*define radio row
       label = "סוג חישוק" ;				//*give it a label

        : radio_button {					//*define radion button
     	  key = "HOOPC" ;					//*give it a name
     	  label = "חישוק סגור" ;			//*give it a label
        }									//*end definition

     	: radio_button {					//*define radio button
     	  key = "HOOPO" ;					//*give it a name
     	  label = "חישוק פתוח" ;			//*give it a label
     	}									//*end definition

     	: radio_button {					//*define radio button
     	  key = "HOOPP" ;					//*give it a name
     	  label = "חישוק לפיתול" ;			//*give it a label
     	  }									//*end definition

		}									//*end radio row

 

LISP

	(if (= HOOPC-value nil)	(setq HOOPC-value "1"))
	(if (= HOOP nil)		(setq HOOP "CLOSE"))
	(set_tile "HOOPC" HOOPC-value)
	
	(action_tile "HOOPC" "(setq HOOP \"CLOSE\")")
	(action_tile "HOOPO" "(setq HOOP \"OPEN\")")
	(action_tile "HOOPP" "(setq HOOP \"PITOL\")")

 

Capture.PNG

Link to comment
Share on other sites

Example:

Add the following codes in okay button and keep the variable 'vars' unlocalized 

(setq vars (mapcar 'get_tile '("HOOPC" "HOOPO" "HOOPP")))

Then add the following at the top to reset the values back as they were when the user press okay button.

(mapcar 'set_tile '("HOOPC" "HOOPO" "HOOPP") vars)

 

Link to comment
Share on other sites

12 hours ago, Tharwat said:

Example:

Add the following codes in okay button and keep the variable 'vars' unlocalized 

(setq vars (mapcar 'get_tile '("HOOPC" "HOOPO" "HOOPP")))

Then add the following at the top to reset the values back as they were when the user press okay button.

(mapcar 'set_tile '("HOOPC" "HOOPO" "HOOPP") vars)

 

I am using old lisp that i want to modify

when i add the codes in the okay button i get error

(progn
(defun 2B_BEAMC (/ action reslist dcl_id BASE PP2 PP3 PP4 PP5 PP6 PP7 PP8 PP9 PP10 PP11)
	(setq action 6
        reslist (list
					(cons "BASE" nil)
					(cons "B_DCL" 			(if (= B_DCL nil) 		30 B_DCL))
					(cons "H_DCL" 			(if (= H_DCL nil) 		60 H_DCL))
				
				);list
	);setq

	(setq dcl_id (load_dialog "BEAM V2022.dcl"))
	(while
		(>= action 2)
		(if
			(null (new_dialog "BEAMC" dcl_id))
			(exit)
		);if
    
	(if (setq BASE 				(cdr (assoc "BASE" reslist))) 				(set_tile "BASE" (PointToString BASE)))
	(if (setq B_DCL 			(cdr (assoc "B_DCL" reslist))) 				(set_tile "B_DCL" (rtos B_DCL 2)))
	(if (setq H_DCL 			(cdr (assoc "H_DCL" reslist))) 				(set_tile "H_DCL" (rtos H_DCL 2)))
   

    (defun CheckValues ()
      (if
        (and BASE B_DCL H_DCL )
        (mode_tile "accept" 0)
        (mode_tile "accept" 1)
      );if
    );defun
    (CheckValues)

(action_tile
      "BASE"
      (strcat
        "(setq BASE (string_to_number (get_tile $key))"
        "      reslist (subst"
        "                (cons \"BASE\" BASE)"
        "                (assoc \"BASE\" reslist)"
        "                reslist"
        "              )"
        ")"
        "(CheckValues)"
      );strcat
    );action_tile

(action_tile
      "B_DCL"
      (strcat
        "(if (setq B_DCL (atof (get_tile $key))) (setvar \"userr4\" B_DCL))"
        "(setq reslist (subst"
        "                (cons \"B_DCL\" B_DCL)"
        "                (assoc \"B_DCL\" reslist)"
        "                reslist"
        "              )"
        ")"
        "(CheckValues)"
      );strcat
    );action_tile

(action_tile
      "H_DCL"
      (strcat
        "(if (setq H_DCL (atof (get_tile $key))) (setvar \"userr4\" H_DCL))"
        "(setq reslist (subst"
        "                (cons \"H_DCL\" H_DCL)"
        "                (assoc \"H_DCL\" reslist)"
        "                reslist"
        "              )"
        ")"
        "(CheckValues)"
      );strcat
    );action_tile
	
	(if (= HOOPC-value nil)	(setq HOOPC-value "1"))
	(if (= HOOP nil)		(setq HOOP "CLOSE"))

	(set_tile "HOOPC" HOOPC-value)	
	(action_tile "HOOPC" "(setq HOOP \"CLOSE\")")
	(action_tile "HOOPO" "(setq HOOP \"OPEN\")")
	(action_tile "HOOPP" "(setq HOOP \"PITOL\")")

	
	(action_tile "cancel"  "(done_dialog 0)")
	(action_tile "accept"  "(done_dialog 1)")
 
	(action_tile "BASEbtn" 			"(done_dialog 2)")
    (action_tile "B_DCLbtn" 		"(done_dialog 3)")
    (action_tile "H_DCLbtn" 		"(done_dialog 4)")


    (setq action (start_dialog))
    (cond
      ( (= action 2)
        (if
          (setq PP2 (getpoint "\nBASE Point: "))
          (setq reslist
            (subst
              (cons "BASE" PP2)
              (assoc "BASE" reslist)
              reslist
            );subst
          );setq
        );if
      );
      ( (= action 3)
        (if
          (setq PP3 (ugetd "\nWidth Of Beam (cm) "))
          (setq reslist
            (subst
              (cons "B_DCL" PP3)
              (assoc "B_DCL" reslist)
              reslist
            );subst
          );setq
        );if
      );
      ( (= action 4)
        (if
          (setq PP4 (ugetd "\nHeight of Beam (cm) "))
          (setq reslist
            (subst
              (cons "H_DCL" PP4)
              (assoc "H_DCL" reslist)
              reslist
            );subst
          );setq
        );if
      );
	  
      ( (= action 0) (setq reslist nil))
    );cond
  );while

	(unload_dialog dcl_id)
	(if (= action 1) (setq reslist reslist) (exit))
;  reslist
);defun
;
)

 

Link to comment
Share on other sites

1 hour ago, Tharwat said:

You need to put the codes in the accept action although that I can't see them in the routine posted !.

Thanks 🙏. Work like a magic

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...