Author Topic: multiple radio buttons working together?  (Read 1316 times)

0 Members and 1 Guest are viewing this topic.

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #15 on: September 04, 2020, 09:15:31 PM »
Not sure if I stuffed up but added spacer_1 to dcl code. Its not staying open.

Code: [Select]
   : boxed_radio_column {
      key = "face";
      label = "Face";
      : radio_button {key = "fac_rjt"; label = "RTJ";}
spacer_1 ;
      : radio_button {key = "fac_rf";  label = "RF";}
spacer_1 ;
      : radio_button {key = "fac_ff";  label = "Flat Face";}
    }
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #16 on: September 05, 2020, 03:40:25 AM »
Cheers Bigal,
This works for me, aligned with the Flange buttons in the LHcolumn.

Code: [Select]
: boxed_radio_column {
label = "Face" ;
 
: radio_button { key = "rb21" ; label = "RTJ"; is_enabled = false;}
        spacer;
: radio_button { key = "rb22" ; label = "RF" ; is_enabled = false;}
        spacer;
: radio_button { key = "rb23" ; label = "Flat Face" ; is_enabled = false;}
        spacer;
        spacer;
        spacer;
        spacer;
        spacer;
}

S.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #17 on: September 05, 2020, 04:19:32 AM »
That is purely cosmetic really
I disagree. There are no DCL buttons that stay pushed in (unless you create your own), so basically with the buttons solution there is no visual feedback for the user.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #18 on: September 05, 2020, 04:31:46 AM »
Hmm,

Now you point that out Roy, you are of course correct, I had not noticed that :whistling:



Though it is not obvious in the image above, as you make a selection the next relevant column is turned ON. The same again each time you make a selection in a column. If you change your mind and go back to the start and select a different option, ALL previous selections are cleared & the columns turned off, including the variables in the lsp.

S.
« Last Edit: September 05, 2020, 04:35:12 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #19 on: September 05, 2020, 08:44:24 PM »
Would a parent child dcl approach maybe be easier than turning off columns ?

A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #20 on: September 06, 2020, 07:37:20 AM »
To be honest Bigal, I'm not sure?

I just creates sub's eg:-

Code: [Select]
(defun L3_ON ()
(mode_tile "rb21" 0)
(mode_tile "rb22" 0)
(mode_tile "rb23" 0)
)
(defun L3_CLEAR ()
(set_tile "rb21" "0")
(set_tile "rb22" "0")
(set_tile "rb23" "0")
)

Then call as required:)
[code]   (action_tile "s1" ;toggle Fitting options
(strcat
"(RESET_VARS)" "(L1_ON)" "(L2_OFF)" "(L3_OFF)" "(L4_OFF)" "(L5_OFF)"
"(L1_CLEAR)" "(L2_CLEAR)" "(L3_CLEAR)" "(L4_CLEAR)" "(L5_CLEAR)"
); end strcat
); END ACTION TILE
[/code]

A question for you, or anyone.

What is the equivalent function to GETVAR, for a local variable in my route?

eg     GETVAR 'fname

S.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #21 on: September 06, 2020, 07:28:08 PM »
Not sure about your question re local variable. You know what it is ?

If you use toggles rather than radio buttons they stay on but have disadvantage can pick more than one so would have to check others and turn them off.

Using the dcl child approach means can not see the next dcl's or open correct one.
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #22 on: September 07, 2020, 03:58:02 AM »
The code below highlights my 'current' problem/issue.

Code: [Select]
(defun OPEN_DIM_FILE ()
;    (setq DIM_FILE (open (findfile 'fname) "r"))  ;need variable 'fname' value here
;    (setq DIM_FILE (open (findfile (getvar fname)) "r")) ;need variable 'fname' value here
     (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))              ;need variable 'fname' value here
 ) ;end OPEN_DIM_FILE

When I add the complete filename into the 'findfile' statement the code works.

However I want the read the value of my local variable 'fname' and place that into the 'findfile' statement.
Where fname is defined
Code: [Select]
   setq fname (strcat ftg flg fce sch clss ".dim"
S.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #23 on: September 07, 2020, 08:46:12 PM »
There are options to getfiled may need some of the extra switches. I dont use findfile very often tend to hard code a location like where dwg is. What happens when does not exist and where would it normally exist so no need for findfile as you know location.
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #24 on: September 08, 2020, 10:43:30 AM »
Well, I think I have found the issue with:-

Code: [Select]
(setq fname (strcat ftg flg fce sch clss ".dim"))
Using
Code: [Select]
(princ (strcat "\nFilename = " fname " "))Placed in a couple of locations in the code it appears that NONE of the variables are inheriting (?) their selected values until after the 'OK' button has been pressed.

For a novice, is this normal? can I change the code so that they inherit the value as it is chosen with the radio buttons?

I've attached a copy of my files for info
S.
« Last Edit: September 08, 2020, 11:50:40 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #25 on: September 09, 2020, 06:43:25 AM »
You are running (setq fname ...) after (unload_dialog ...), so what you are seeing is to be expected. If you want to update the fname whenever a radio is modified you should add (setq fname ...) to each radio action. You would also have to look at the RESET_VARS function as strcat will fail if one of the parameters is nil.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #26 on: September 09, 2020, 07:36:05 AM »
Hi Roy,

Thanks for the input.

I've commented out ( ; ) the RESET_VARS.
added a new defun
Code: [Select]
(defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME

Code: [Select]
(defun OPEN_DIM_FILE ()
  (if (= NEWTILE "rb41") ;
;    (setq DIM_FILE (open (findfile "wnrf.dim") "r"))  ;need variable 'fname' value here
    (setq DIM_FILE (open (findfile fname) "r"))  ;need variable 'fname' value here
; (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))  ;need variable 'fname' value here
  ) ;_ end of if
 ) ;end OPEN_DIM_FILE

Then modified a radio button (the schedule)
Code: [Select]
(action_tile "rb41"
(strcat
"(RB41_FLAG)" "(READ_DIM_FILE)" "(F_NAME)"
); end strcat
); END ACTION TILE

but this does not work :(

S.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #27 on: September 09, 2020, 09:18:17 AM »
Even for a person with limited Lisp knowledge it should be obvious why your code fails.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #28 on: September 09, 2020, 09:20:39 AM »
Just to add a little more info.
I've added a princ statement in a couple of places:

Code: [Select]
(defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME
    (princ (strcat "\nFilename after F_NAME = " fname " "))

Quote
(defun OPEN_DIM_FILE ()
;  (if (= NEWTILE "rb41")                                    ;
;    (setq DIM_FILE (open (findfile fname) "r"))                    ;need variable 'fname' value here
   (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))     ;need variable 'fname' value here
;  ) ;_ end of if
 ) ;end OPEN_DIM_FILE
    (princ (strcat "\nFilename after open_dim_file = " fname " "))

plus the one after (unload_dialogue).

And this is what is reported at the command line:

Quote
Filename after F_NAME = 
Filename after open_dim_file = 
Command: samp4
Filename after unload_dialog = wn_rf_sch_20#300.dim
[/size]

action_tile rb41 is unchanged from above

S.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #29 on: September 09, 2020, 09:31:38 AM »
Even for a person with limited Lisp knowledge it should be obvious why your code fails.

Oh  :wideeyed:

You have obviously found something! which narrows down my problem :) (I just wish I could see it)
the (setq fname (strcat ftg flg fce sch clss ".dim")) statement works as I get a filename after unload.
But I don't get any results from the other two?


S.
There is no such  thing as a 'silly question' to those who do not know!