DCL Toggle column.Deselect automatically the standard one by selecting the other

DCL Toggle column.Deselect automatically the standard one by selecting the other

C.Utzinger
Collaborator Collaborator
1,325 Views
5 Replies
Message 1 of 6

DCL Toggle column.Deselect automatically the standard one by selecting the other

C.Utzinger
Collaborator
Collaborator

HI

 

I have this DCL-File and i want to deselect tog1 (witch is Standard) when i choose the other ones.

 

Is that possible???

 

test_dcl3
 
: dialog
 
{
label = "Breinigen!!!";
 
	: text
	{
	label = "Willst du den Plan bereinigen?                ";
	alignment = centered;
	}
 
	: column {

		: toggle {
		key = "tog1" ;
		label = "Komplett bereinigen (inkl. alle Ref.)" ;
		value = "1";
		}

		: toggle {
		key = "tog2" ;
		label = "Komplett bereinigen" ;
		}

		: toggle {
		key = "tog3" ;
		label = "Blöcke" ;
		}

		: toggle {
		key = "tog4" ;
		label = "Layer" ;
		}

		: toggle {
		key = "tog5" ;
		label = "Referenzen (nur Xrefs)" ;
		}

		: toggle {
		key = "tog6" ;
		label = "Referenzen (alle)" ;
		}
	}

	: row {

	: button
	{
	key = "ja";
	label = "Ja";
	is_default = true;
	alignment = centered;
	width = 1;
	}
	
	: button
	{
	key = "nein";
	label = "Nein";
	is_default = false;
 	is_cancel = true;
	alignment = centered;
	width = 1;
	}
	}
}
0 Likes
Accepted solutions (1)
1,326 Views
5 Replies
Replies (5)
Message 2 of 6

Jonathan3891
Advisor
Advisor

you need to use a "radio_column" for one radio button to turn off when another is selected.

 

: column { 
            : radio_column { 

You can read more about that on Jeffry P Sanders website, located here


Jonathan Norton
Blog | Linkedin
Message 3 of 6

C.Utzinger
Collaborator
Collaborator

Thank you but i know that.

 

The Problem is i want to select mor than one, but the first one (standard selected) must turn off when i select other (2 or 3).

 

Kind Regards

0 Likes
Message 4 of 6

scot-65
Advisor
Advisor
Accepted solution
Untested - typing here on the fly...

In your LSP file, in the action tile section:

(action_tile "tog1" "(TEST_S1 $value)")
(action_tile "tog2" "(TEST_S2 $value)")
...

where:
(defun TEST_S1 ( a / ) ;clear all toggles when first one is checked
(if (= a "1")
(foreach x (list "tog2" "tog3" "tog4" "tog5")
(set_tile x "0")
);foreach
);if
);end

(defun TEST_S2 ( a / ) ;clear first toggle only
(if (= a "1")
(set_tile "tog1" "0")
);if
);end

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

Message 5 of 6

john.uhden
Mentor
Mentor

Nice.  Or, on the fly...

 

(action_tile "tog1" "(toggle $key $value)")
(action_tile "tog2" "(toggle $key $value)")
(etc.)

(defun toggle (key value)
  (cond
    ((= key "tog1")
      (mapcar '(lambda (x)(set_tile x "0")) '("tog3" "tog4" etc.))
    )
    ((= key "tog2") ...)
    (etc.)
  )
)

I forgot to use value, but you should get the idea.

John F. Uhden

Message 6 of 6

scot-65
Advisor
Advisor

An alternate method that I think is what you are trying to do.
Follow me on this...

 

In the DCL file:
:radio_column {key="Rad0";
 :radio_button {key="Rad1"; label="Default";}
 :radio_button {key="Rad2"; label="Custom";}
}
:row {fixed_width=true;
 :spacer {width=1.0;}
 :column {key="Col1";
  :toggle {key="Tog1";}
  :toggle {key="Tog2";}
  :toggle {key="Tog3";}
  :toggle {key="Tog4";}
 }
}


Now, in the LSP file [between new_dialog and start_dialog]:
;** Initialize **
(or USER_TEST (setq USER_TEST (list "Rad1" "1" "0" "0" "0")))
;** Set Tile **
(set_tile "Rad0" (nth 0 USER_TEST))
(set_tile "Tog1" (nth 1 USER_TEST))
(set_tile "Tog2" (nth 2 USER_TEST))
(set_tile "Tog3" (nth 3 USER_TEST))
(set_tile "Tog4" (nth 4 USER_TEST))
;** Mode Tile **
(if (= (get_tile "Rad0") "Rad1") (mode_tile "Col1" 1))
;** Action Tile **
(action_tile "Rad1" "(mode_tile \"Col1\" 1)")
(action_tile "Rad2" "(mode_tile \"Col1\" 0)")
(action_tile "accept" "(TEST_GET)(done_dialog 1)")


Where:
(defun TEST_GET ()
 (setq USER_TEST (list
  (get_tile "Rad0")
  (get_tile "Tog1")
  (get_tile "Tog2")
  (get_tile "Tog3")
  (get_tile "Tog4")
 ))
);end
USER_TEST is not declared in the program's defun line.
This makes it a session only Gremlin that remembers
the values from last time and will reload the next time
the program is called. It is also used as a container
of values for when you enter into your "Main" program.

Again, typing on the fly...

 

Hope this helps.

 

Scot-65

 

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes