CafeJr Posted July 2, 2015 Posted July 2, 2015 (edited) Hi, I was working with a DCL and Lisp a few days and got some doubts: 1 - radio_button: 1.1 - Has there a way to check between a number "x" of radio_button, which is the currently radio_button selected? 1.2 - To run the code and to select a first item, I use on DCL file, as enabled: is_enabled = true (it only put a dot on that item, but not select it as a click over there, in other words, only show a dot image). On lisp code I wrote to try to execute a action: (set_tile "rb1" 1), but not works, in the same way not as a click over there. 2 - toggle_button. 2.1 - The toggle button has a possibility to do a action_tile when it is pressed a first time (before to be selected), to "deselect" it is there a whay to do one action? eg.: when I select the toggle, I show one image, but when I deselect it, the image need to be changed, is there how to do it? Thanks in advance to any help!... Edited July 2, 2015 by CafeJr Quote
rlx Posted July 2, 2015 Posted July 2, 2015 Just a piece of code : (action_tile "tg_ct_matchtextcase" "(setq #matchtextcase $value)") (action_tile "rb_ct_range_e" "(setq #useextends $value)(CT_SelectRange_e)") (action_tile "rb_ct_range_w" "(setq #usewindow $value)(CT_SelectRange_w)") the first line is about a toggle , I just catch the $value. If you want to start an action you will have to add a call to another routine or close your dialog with done_dialog. the other 2 lines are for radio buttons. Each radio button has its own unique name. My variable #useextends can be "1" or "0". After you catch this value the program goes to another routine , (CT_SelectRange_e in my example) , for you use your own routine. There you can do whatever you like , start another part of the program , update a slide ... You can use done_dialog to leave the current dialog and depending on the done_dialog return value do something else... (done_dialog 5) for example Typically (done_dialog 1) is for ok and (done _dialog 0) for cancel Anywayz , you can refresh your dialog by starting it again of have a separate routine to do so , (update_my_dialog) and there you can set every toggle , radio button in advance before you actually start your dialog gr. R. btw (set_tile "rb1" 1) wont work , use (set_tile "rb1" "1") Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 Just a piece of code : (action_tile "tg_ct_matchtextcase" "(setq #matchtextcase $value)") (action_tile "rb_ct_range_e" "(setq #useextends $value)(CT_SelectRange_e)") (action_tile "rb_ct_range_w" "(setq #usewindow $value)(CT_SelectRange_w)") ... Thanks to the fast answer rlx!... I'm trying to understand and apply it!... Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 btw (set_tile "rb1" 1) wont work , use (set_tile "rb1" "1") Also do not has the expected result... Eg: Quote
rlx Posted July 2, 2015 Posted July 2, 2015 sorry for the old and sometimes bad coding but I needed somthing quick and simple you know... maybe these files can help you One routine I used to use to place a datestamp on my drawing and the other routine I still use to scale up drawings or images. gr.R DateStamp.dcl DateStamp.lsp ScaleDwg.dcl ScaleDwg.LSP Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 sorry for the old and sometimes bad coding but I needed somthing quick and simple you know... maybe these files can help you One routine I used to use to place a datestamp on my drawing and the other routine I still use to scale up drawings or images. gr.R Don't worry rlx! Any help is welcome!... I'll check it!!!... Thanks again!... Quote
rlx Posted July 2, 2015 Posted July 2, 2015 either you have grouped your radio button and toggles together in a wrong way or you must have a look at the 'mode_tile' function , which gives you controll to enable or disable a (radio)button or a toggle. Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 either you have grouped your radio button and toggles together in a wrong way or you must have a look at the 'mode_tile' function , which gives you controll to enable or disable a (radio)button or a toggle. I guess don't... I checked the structure code and had wrote it in some different places to test and nothing... I don't know, but the set_tile doesn't work only together with a action_tile?... Quote
Tharwat Posted July 2, 2015 Posted July 2, 2015 Hi, Frankly I did not get your point of this thread , so can you explain your doubts in codes with direct explanation straight to the point ? Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 Hi, Frankly I did not get your point of this thread , so can you explain your doubts in codes with direct explanation straight to the point ? Thanks to ask... I'm trying to understand how some functions works, or if has one alternative to them. I only do in another thread to not mix the issues. Remember the thread tha you helped me? (Deti) There are 9 toggle_buttons since their works together, has how to get which one is currently selected? Eg.: rbx returns number of radio_button selected... rb1, rb2 or rb9. DCL: Deti : dialog { //dialog name label = "Detalhamento de instalação" ; //give it a label : row { //*define row :boxed_radio_column { //define radio column label = "Ti&po:" ; //give it a label : radio_button { //define radion button key = "rb1" ; //give it a name label = "&C" ; //give it a label value = "1" ; //switch it on is_enabled = true ; } //end definition : radio_button { //define radio button key = "rb2" ; //give it a name label = "&E" ; //give it a label } //end definition : radio_button { //define radion button key = "rb3" ; //give it a name label = "&X" ; //give it a label } //end definition : radio_button { //define radio button key = "rb4" ; //give it a name label = "L&B" ; //give it a label } //end definition : radio_button { //define radio button key = "rb5" ; //give it a name label = "L&L" ; //give it a label } //end definition : radio_button { //define radio button key = "rb6" ; //give it a name label = "L&R" ; //give it a label } //end definition : radio_button { //define radion button key = "rb7" ; //give it a name label = "&T" ; //give it a label } //end definition : radio_button { //define radion button key = "rb8" ; //give it a name label = "BR" ; //give it a label } //end definition : radio_button { //define radion button key = "rb9" ; //give it a name label = "LUR" ; //give it a label } //end definition : boxed_row { label = "Sobe / Desce" ; :toggle { alignment = centered ; label = "&Sobe" ; key = "tog1" ; value = "0" ; } :toggle { alignment = centered ; label = "&Desce" ; key = "tog2" ; value = "0" ; } } } //end radio column : boxed_column { //*define boxed column label = "Bitol&a" ; //*give it a label : popup_list { //*define popup list alignment = centered; key = "Bitolas" ; //*give it a name value = "1" ; //*initial value } //*end list :image {height = 3; width = 0;aspect_ratio=0.8;color=0;fixed_height=true;key = "img";} } //*end boxed column } //*end row ok_cancel ; //predifined OK/Cancel : row { //define row : image { //define image tile key = "im" ; //give it a name height = 1.0 ; //and a height width = 2.0 ; //and now a width } //end image : paragraph { //define paragraph : text_part { //define text label = "Elaborado por:" ; //give it some text } //end text : text_part { //define more text label = "José Roberto dos Santos Junior."; //some more text - Credits to Kenny Ramage } //end text } //end paragraph } //end row } //end dialog To start that code (Deti) if you don't select any radio_button get one error, both of these two actions don't work: DCL: is_enabled - only fill the radio_button with a dot image; LISP: (set_tile "rb1" "1") - do nothing. I'm trying to "force" the code to select as a previous selection the first radio_button, if's possible. Quote
Tharwat Posted July 2, 2015 Posted July 2, 2015 if you don't select any radio_button get one error, both of these two actions don't work: With radio_buttons you are not allowed to do that so there must be one radio button set to 1 in DCL file or from the lisp codes with the use of set_tile function. LISP: (set_tile "rb1" "1") You already have the first radio button with the key "rb1" is set to 1 from the DCL file which is value = "1" You still did not describe what you want clearly . Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 (edited) With radio_buttons you are not allowed to do that so there must be one radio button set to 1 in DCL file or from the lisp codes with the use of set_tile function. Ok!... I got it!... tks You already have the first radio button with the key "rb1" is set to 1 from the DCL file which is value = "1" You still did not describe what you want clearly . Let me try again, I apologise if I'm not so clear!... Running that code (Deti), the window cames with the first item previouly selected from the DCL instruction, but it does not work as it should. If no one radio_button is selected (even using is_enable = true; or set_tile), and you press the "OK" button, it stop the code with one error and do not insert the block (that was previously selected on DCL, the first item). Edited July 2, 2015 by CafeJr Quote
Tharwat Posted July 2, 2015 Posted July 2, 2015 Running that code (Deti), the window cames with the first item previouly selected from the DCL instruction, This is normal because it's already set from the DCL as I SAID before with the use of value function and set to 1 but it does not work as it should. If no one radio_button is selected If any error occurred , that would be due to your settings and not due to the radio button itself. (even using is_enable = true; or set_tile) Actually the is_enabled tile should not be included in the DCL file besides that there is not need to use set_tile function since that already set from the DCL file. it stop the code with one error and do not insert the block (that was previously selected on DCL, the first item). That is also due to your settings and not due to any function at all . Quote
CafeJr Posted July 2, 2015 Author Posted July 2, 2015 - This is normal because it's already set from the DCL as I SAID before with the use of value function and set to 1 - If any error occurred , that would be due to your settings and not due to the radio button itself. - Actually the is_enabled tile should not be included in the DCL file besides that there is not need to use set_tile function since that already set from the DCL file. - That is also due to your settings and not due to any function at all . I understood all items!... Thanks... Well, I update that code, if you can check there, the previous selection on DCL do not occurs as a click over the radio_button runing the actio_tile function: My confusion could be about that: if radio_button is selected in DCL file it can or not execute the action_tile and their functions? (action_tile "rb1" "(setq tipo \"C\")(mode_tile \"tog1\" 1)(mode_tile \"tog2\" 1)(showimage (strcat Path (car files)))" ) Quote
rlx Posted July 2, 2015 Posted July 2, 2015 I dont know if your problems are over yet but i just want to show how i would deal in general. Portugees is not my lanuage so sometimes its rather hard to follow ;-) (defun c:deti ( / dclname drv ) (if (and (setq dclname (findfile "deti.dcl")) (setq deti-Dcl (load_dialog dclname))) (progn (new_dialog "Deti" deti-Dcl) (Deti_UpdateDialog) (action_tile "accept" "(done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (action_tile "rb1" "(setq rb1-var $value)(Deti_UpdateDialog)") "" (setq drv (start_dialog)) (cond ((= drv 0)(alert "cancel")) ((= drv 1)(alert "ok")))))) (defun Deti_UpdateDialog () ;init vars , set defaults here (if (not (boundp rb1-var))(setq rb1-var "0")) (if (not (boundp Sobe-var))(setq Sobe-var "1")) (if (not (boundp Desce-var))(setq Desce-var "1")) ;set your radio button here (cond ((= rb1-var "1")(set_tile "rb1" "1")) ((= rb2-var "1")(set_tile "rb2" "1")) ;etc (t (setq rb1-var "1")(set_tile "rb1" "1"))) ;set your toggles (if (= Sobe-var "1")(set_tile "tog1" "1")) (if (= Desce-var "1")(set_tile "tog2" "1")) ;start your listbox etc ;maybe make something else happen (cond ((and (= rb1-var "1")(= Desce-var "1"))(deti_updateImage "picture01")) ((and (= rb1-var "0")(= Desce-var "0"))(deti_updateImage "picture02")) ) ) Before I start my dialog i first check all my variables. Here I do this in Deti_UpdateDialog but you could split it up in a separate 'init-dialog' and a update dialog routine. You then would call the init dialog once and for every action tile you could call de update dialog if needed If you keep your variables open (dont 'put them next to your defun') , next time you start your program you can start from where you left your settings last time. anywayz , hope you get your program working gr. R. Quote
CafeJr Posted July 3, 2015 Author Posted July 3, 2015 (edited) I dont know if your problems are over yet but i just want to show how i would deal in general. Portugees is not my lanuage so sometimes its rather hard to follow ;-) Please, don't worry about language!... I'm not specialist in English as I need or I want (as you can see!)!... But is possible a communication (I guess)!... He he he... Before I start my dialog i first check all my variables. Here I do this in Deti_UpdateDialog but you could split it up in a separate 'init-dialog' and a update dialog routine. You then would call the init dialog once and for every action tile you could call de update dialog if neededIf you keep your variables open (dont 'put them next to your defun') , next time you start your program you can start from where you left your settings last time. anywayz , hope you get your program working gr. R. Thanks to the tips, I'll try to follow it as a example and your considerations!... Edited July 3, 2015 by CafeJr Quote
Recommended Posts
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.