I am having a problem getting two Radio Buttons to work correctly. When I run the program. the Dialog displays fine. I can Choose either "Elevation" or "Plan" under the views section. If i want to select the other instead of the first, the dialog crashes. What could cause the crash? I must be overlooking something.
All suggestions are welcome. Any improvements are welcome.
I have included both files. The main body of the lisp file is incomplete, as far as the function goes. I have not coded that in yet.
Thanks.
Here is the Code:
I have this code in my DCL file:
:radio_column {
label = "Views";
fixed_width = true;
fixed_height = true;
alignment = top;
: radio_button {
label ="&Elevation";
key = "hrelvn";
}
: radio_button {
label ="&Plan";
key = "hrpln";
}
}//end radio column
This is the code in my .lsp for the action tile, under the dialog box:
(action_tile "hrelvn"
"(hrelvn)")
(action_tile "hrpln"
"(hrpln)")
This is the code in my .lsp for three sub-routines:
(defun hrpln ()
(progn
(setq hrpln "T")
(setq hrelvn "F")
);end progn
);end defun
;
(defun hrelvn ()
(progn
(setq hrpln "F")
(setq hrelvn "T")
);end progn
);end defun
(defun resethrvars ()
(progn
(setq os (getvar "osmode"))
(setq MATL nil)
(setq PC_MK_RQD nil)
(setq PC_MK nil)
(setq hrpln nil)
(setq hrelvn nil)
(setq GAP_LT nil)
(setq GAP_RT nil)
(setq WING_LT nil)
(setq WING_RT nil)
(setq WINGLT nil)
(setq WINGRT nil)
(setq hrtype nil)
(setq chk1 "N")
(setq chk2 "N")
(setq chk3 "N")
);end progn
);end defun
This is the main Body of the code:
(defun C:HR2014 (/ os chk1 chk2 chk3 MATL)
(setvar "cmdecho" 0)
(setq os (getvar "osmode"))
(setq olderr *error*
*error* CHGTERR)
(resethrvars)
(while
(or
(= chk1 "N")(= chk2 "N")(= chk3 "N")
);end or
(hrdialog)
(if
(= MATL nil)
(alert "Must Select Material Type!")
(setq chk1 "OK")
);end if
(if
(= PC_MK_RQD nil)
(alert "Must Select Piece Mark Type!")
(setq chk2 "OK")
);end if
(if
(or
(/= hrelvn "T")(/= hrpln "T")
);end and
(alert "Must Select View!")
(setq chk3 "OK")
);end if
);end While
(hrdist)
);end defun
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Your (resethrvars) nullifies those functions: (setq hrpln nil) (setq hrelvn nil)
So just change those function calls to a different name like (defun hrpln- .... and (defun hrelvn- .... see attached revised lsp.
AOL @ Exchange App Store DDSetup @ Exchange App Store
You are very welcome.
>>
>> Any improvements are welcome.
>>
As an alternative to the method you developed:
- Delete the action_tile for each radio_button (ALL radio buttons except those that will toggle mode_tile).
- Assign a key for the [EACH] radio_column (or radio_row, boxed_radio_column, etc.).
- In the action_tile "accept" area, make a call to a subroutine to record all tiles' current status:
(action_tile "accept" "(HANDRAILS_GET)(done_dialog 1)").
The handrails_get subroutine is designed to take a "snapshot" of the current geometry of the dialog when OK is pressed.
This is where you will get the value of that radio_column. For your example it will return either "hrelvn" or "hrpln".
Repeat for all tiles and save as a list.
To store this list, either set it as a local variable (setq), session variable [Gremlin] (with a "USER_" prefix), or a dictionary
item (permanent to the file itself) using VLAX-LDATA-PUT. Registry, write to file, and SETCFG are other methods of
storage.
You will find that coding will be significantly less when developing the dialog, and information from the dialog is
all in one place, as a single variable - to be accessed via NTH after the dialog is closed.
(defun HANDRAILS_GET ()
(setq USER_HANDRAIL (list
(get_tile "Handrail")
(get_tile "Material")
(get_tile "Views")
(get_tile "Piece")
etc.
))
);end HANDRAILS_GET
Using example above and your notation:
(if (= (nth 2 USER_HANDRAIL) "hrelev")... will return "hrelev" or "hrpln".
For more than two radio buttons, construct a COND and go from there.
FWIW, I did not develop programs using LIST as storage until I started doing DCL. To me, these two go hand-in-hand.
Hope this helps.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Hmmmmmm. Interesting. I'll try this when i get a chance.
@scot-65 wrote:
- Assign a key for the [EACH] radio_column (or radio_row, boxed_radio_column, etc.).
I just got back to working with this. I am not sure if I understand correctly. Is this what You mean? If not, would you please give an example.
: row {
: column {
:radio_column {
label = "Handrails";
Key = "Handrails";
fixed_width = true;
fixed_height = true;
alignment = top;
: radio_button {
label ="&HR Wing RT";
key = "HR-SWR";
}
: radio_button {
label ="&HR Wing LT";
key = "HR-SWL";
}
: radio_button {
label ="&HR Single";
key = "HR-S";
}
: radio_button {
label ="&HR Single - Wing RT";
key = "HR-S-SWR";
}
: radio_button {
label ="&HR Single - Wing LT";
key = "HR-S-SWL";
}
: radio_button {
label ="&HR Single - Double Wing";
key = "HR-S-DW";
}
: radio_button {
label ="&HR Double";
key = "HR-D";
}
: radio_button {
label ="&HR DOUBLE - Wing RT";
key = "HR-D-SWR";
}
: radio_button {
label ="&HR DOUBLE - Wing LT";
key = "HR-D-SWL";
}
: radio_button {
label ="&HR Double - Double Wing";
key = "HR-D-DW";
}
}//end radio column
}//end column
scot-65 wrote:
- In the action_tile "accept" area, make a call to a subroutine to record all tiles' current status:
I have remarked ou the tiles you indiaded and here rere is the line I have tried for the "Accept" tile.
(action_tile "accept" "(HANDRAILS_GET)(savevars)(done_dialog 1)")
Where HANDRAILS_GET ia as you difind it:
(defun HANDRAILS_GET ()
(setq USER_HANDRAIL (list
(get_tile "Handrail")
(get_tile "Material")
(get_tile "Views")
(get_tile "Piece")
etc.
))
);end HANDRAILS_GET
When I run !USER_HANDRAIL, I get a return of (nil "mat-stl" "hrelvn" nil). Tiles two and three seem to be working, but a nil response to tiles one and fout indicates that I am doing something wrong, I think.
I must be overlooking something simple.
Any suggestion?
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.