Jump to content

Recommended Posts

Posted

I would like to create a lisp function that has a DCL file as the data input window. This in itself is easy enough to do, however once specific edit_boxes have values inserted into them I would like to automatically update other edit_boxes in the same Dialog box immediately; for example (simple) if the 1st edit_box prompted for a number, and the 2nd edit_box prompted for another number, then the 3rd edit_box should display the sum of the two numbers and allow user input to change if required.

 

It is my understanding that as long as the function does not include a "command" then this is possible, performing calculations only should be ok, however I am not having any luck in accomplishing this.

 

Could someone post a simple lisp routine for this, just so I could see the structure and syntax involved. Unless something special needs to go in the DCL file there is no need to post the DCL code.

 

Thank you.

Hope everyone had a Great Turkey Day.....

Posted

The code is in the dcl not lisp this example takes the 3 values of a double skin wall you can slide you can enter a value and it updates the total display as you do it. Its cut out of a big DCL so hopefully it will still work.

 

/ dialog box cavity
// *******************************************************************
// cavity edit box           
           
cavity : dialog {            
   : boxed_column {
typeface = "Arial";
pointsize = 8;
               label = "Cavity wall sizes:";
               : edit_box {
                   key = "cav1";
                   label = "Outside";
          //         width = 3;
            //       fixed_width = true;
                   value = 110;
               }
                   : slider {
                   key = "cav2";
                   min_value  = 1;
                   max_value = 250;
                   value = 110;
                   big_increment = 5;
                   }
               : edit_box {
     //              mnemonic = "Q";
                   key = "cav3";
                   label = "Cavity ";
              //     width = 3;
                //   fixed_width = true;
                   value = 60;
               }
                   : slider {
                   key = "cav4";
                   min_value  = 1;
                   max_value = 250;
                   value = 60;
                   big_increment = 5;
                   }
               : edit_box {
   //                mnemonic = "Q";
key = "cav5";
                   label = "Inside ";
                   width = 3;
                   fixed_width = true;
                   value = 100;
               }
                   : slider {
                   key = "cav6";
                   min_value  = 1;
                   max_value = 250;
                   value = 100;
                   big_increment = 5;
                   }
    }
            : boxed_column {
                   : row {
                   label = "Total width";                 
                   : text {
                   key = "cav7";
                   width = 3;
                   fixed_width = true;
                   value = "270";
               }
           }
           }       
 spacer_1;
 ok_cancel;
}

  • 11 years later...
Posted

Hi Snownut! Did you ever figure out how to do this? I'm trying to do something similar :) Thanks!!

Posted

Hahaha nvm, I found the answer I needed!

Posted

Perhaps you could share the answer with the rest of us.

Posted

What I was trying to do originally was offer the user of my dialog box two options for picking a point; either selecting the point onscreen, or typing the coordinates into two edit boxes. However, if the user chose the point onscreen, I wanted to update the edit boxes with the coordinates of the point they chose. I got that to work (yay!) and I used a very similar approach to solve this problem. I had to use one small cheat (in order to calculate the sum, you have to check a toggle box) but I don't think this would be too much trouble for your user.

 

The most important thing I learned since my original post was how to use set_tile and how to use a while loop to "refresh" a dialog box for calculations. This tutorial was great for the latter! https://www.afralisp.net/dialog-control-language/tutorials/hiding-dialog-boxes-revisited-part-2.php

 

Attached are the two .lsp files I wrote along with the dcl and a picture of the dialog box. I'm very beginner to autolisp and DCL, so this is undoubtedly not the most elegant solution, but I think it woks pretty well!

dialog_box.png

testytesty.dcl testytesty.lsp check.lsp

  • Like 1
Posted

Did you look at what I posted 12 years ago, this has sliders as well for input. The Total is "text".

 

image.png.c3fd95b512803d09bab288f7131da8b4.png

  • Like 1
Posted
On 11/25/2010 at 8:09 PM, Snownut said:

then the 3rd edit_box should display the sum of the two numbers and allow user input to change if required.

I might be misinterpreting this, but I thought that this meant that the user should be able to change the sum after it was computed, if they wanted to. So that's why I thought it should be an edit box, not text. Totally could be misreading that though.

Posted

It can be text or a edit box its up to you I would have thought don't want people changing the sum.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...