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

0 Members and 1 Guest are viewing this topic.

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #30 on: September 09, 2020, 10:02:57 AM »
Roy, can you show me where the problem is please? or point me in the right direction.
I've been fighting this for over a week now.

I feel like I'm in a forest but I cannot see any trees, (or icebergs as someone once said !)

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

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #31 on: September 09, 2020, 07:47:26 PM »
; semi colons in dcl have meanings also had problems just testing strcat something to with like unicode-8 etc. Should be able to just do the "(RB41_FLAG) (READ_DIM_FILE) (F_NAME)" no need for strcat.
A man who never made a mistake never made anything

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #32 on: September 10, 2020, 02:46:02 AM »
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 :(
You have started out with code from www.afralisp.net, I advise you to follow more of their tutorials, you need more Lisp skills to finish this project.

As @BIGAL has pointed out you do not need strcat in the quoted code. But you do have to call the F_NAME function before using the filename in READ_DIM_FILE. And when using strcat to compose the filename the variables used have to contain strings, so you have to either initialize default string values or determine all of them by checking the current state of the dialog.

I personally would not attach actions to individual radios, I prefer to attach them to the radio columns or rows instead. But it seems that the writer of the AfraLISP DCL tutorials was unaware that this is possible.

For more tutorials check out: https://www.autolisp-exchange.com/

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #33 on: September 10, 2020, 04:01:42 AM »
Thank you guys, your patience IS appreciated.


@BIGAL
I added
Code: [Select]
dcl_settings : default_dcl_settings { audit_level = 3; } (found on https://www.autolisp-exchange.com/)
The error log was mostly refering to text alignments, so I resolved those. There are a few remaining issues:

Quote
*** DCL semantic audit of samp4.dcl***

Warning in "samp4". (widget type = text, key = "n1")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n6")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n7")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n2")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n3")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n5")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n4")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n8")
    Text widgets need  a 'label' or a 'width'.

@ROY_43,
Quote
you need more Lisp skills to finish this project.
Oh so painfully true!
Thanks for the pointers.
Back to the library!!

S.



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

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #34 on: September 10, 2020, 08:31:19 AM »
Code: [Select]
(action_tile "rb41"
"(RB41_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE

But you do have to call the F_NAME function before using the filename in READ_DIM_FILE.



Would simply changing the order as above be enough?

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

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #35 on: September 11, 2020, 03:52:48 AM »
Ron,

Quote
And when using strcat to compose the filename the variables used have to contain strings, so you have to either initialize default string values or determine all of them by checking the current state of the dialog.

I am confused by this statement (I suspect you are not surprised ).

For each radio button I thought I had defined the variable as a string
eg
Quote
   (defun RB41_FLAG ()
   (setq sch "sch_5")                              ;store schedule rating
   );end rb41_flag
In this case when radio button 41 is selected the string "sch_5" is stored as the current value for the variable sch

where a string is defined as any group of characters  having quotation marks surrounding them to indicate that they are strings


As only 1 radio button in each column can be active, hence am I not "determine all of them by checking the current state of the dialog"

Could you explain a little more please?

S.
« Last Edit: September 11, 2020, 03:56:15 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #36 on: September 15, 2020, 03:52:10 AM »
Well I finally found the problem.
It was me all along, such a small thing caused me so much grief.

What was it? I had missed a '_' from the schedule string. (just as Roy had hinted at)

In the above example:
Code: [Select]
   (defun RB41_FLAG ()
   (setq sch "sch_5")                              ;store schedule rating
   );end rb41_flag

This now reads:
Code: [Select]
   (defun RB41_FLAG ()
   (setq sch "sch_5_")                              ;store schedule rating
   );end rb41_flag

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

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #37 on: September 18, 2020, 07:27:31 AM »
I'm back for a bit more guidance please.

So far I have had simple Action Tiles, I now need to make some a little more complicated (for me!)

Example
Code: [Select]
(action_tile "rb31" ;toggle #300 option
"(L5_ON)(RB31_FLAG)"
); END ACTION TILE

Code: [Select]
(action_tile "rb31" ;toggle #300 option
      "(setq newtile $key)(RB31_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE

Both of the above have been used as this project has progressed and both work as I expected.
Now I want to use both depending on a previous radio button selection (rb11)
Here is rb11 code
Code: [Select]
(defun RB11_FLAG ()
(setq flg "wn_") ;store flange type
);end rb11_flag


In words:
if the user selects rb11 I want to execute the first code above, and if rb11 is not selected (any of the other options selected) then I want to execute the second code above.

So here is what I have:
Code: [Select]
(action_tile "rb31" ;toggle #150 option
(if
(= flg wn_) ;if variable weldneck flange selected do this
(progn
(L5_ON)
(RB31_FLAG)
);end progn
;---------------------------;
; ;otherwise  if ANY of bl/so/scr/sl are set do this
(progn
(setq newtile $key)
(RB31_FLAG)
(F_NAME)
(READ_DIM_FILE)
);end progn
) ;_ end of if
); END ACTION TILE

When I select rb31 nothing happens!
Where have I gone wrong?
Can I actually do this?
Any help would be appreciated.

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

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #38 on: September 18, 2020, 04:39:27 PM »
Code - Auto/Visual Lisp: [Select]
  1.   "rb31"
  2.   "(if (= flg \"wn_\")
  3.    (progn
  4.      (L5_ON)
  5.      (RB31_FLAG)
  6.    )
  7.    (progn
  8.      (setq newtile $key)
  9.      (RB31_FLAG)
  10.      (F_NAME)
  11.      (READ_DIM_FILE)
  12.    )
  13.  )"
  14. )

sln8458

  • Newt
  • Posts: 91
  • CMS Intellicad 9.0/10.0
Re: multiple radio buttons working together?
« Reply #39 on: September 19, 2020, 02:50:18 AM »
Many thanks Roy.
Works a treat :)

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