Jump to content

Recommended Posts

Posted

I have a program that uses a dialog box, but upon pressing a button, I want the dialog to go away, the user selects a block, and then the dialog comes back up.

 

thank you.

 

argV

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • flowerrobot

    8

  • ARGV

    7

  • The Buzzard

    6

  • Lee Mac

    5

Top Posters In This Topic

Posted

Bro, Your giving us nothing to work with here.

 

To make a dialouge box disapear for a while and then reapear.

use the (done_dialogue) where you want the dcl to shut, i would also recommend storing the previously inputted settings,

 

Then i personaly use a while command, so that while accept or cancel (in most cases) isnt press, do what is needed then restart the program.

for example

 

pressing this button will close the button, and set ok and what mode to open

(action_tile "punkin" "(setq ok 3 typemode \"REDUCER\")(done_dialog)")

you could place commands, then recall the current dcl after the cond.

(while (not (= ok 0)(= ok 1))
  (cond 
   ((= typemode "TEE")
    (Tee_Controlls))
   ((= typemode "REDUCER_TEE")
    (Reducer_Tee_Controlls))
   ((= typemode "ELBOW")
    (Elbow_Controlls))
   ((= typemode "reducer")
[color=navy] (princ "\nSelect the block")[/color]
[color=navy]    (setq avar (entsel))[/color]
  )
[color=navy](previousedcl_box)[/color]
 )

Posted

The done_dialog function can be assigned an exit flag which can be any integer (except 0 and 1, these are reserved for the Accept and Cancel tiles).

 

This flag can be retrieved from the start_dialog function:

 

(setq flag (start_dialog))

 

See here for more:

 

http://www.afralisp.net/lispa/lisp43b.htm

Posted
Bro, Your giving us nothing to work with here.

 

I think there is enough that we can provide ample help and advice :)

Posted
I have a program that uses a dialog box, but upon pressing a button, I want the dialog to go away, the user selects a block, and then the dialog comes back up.

 

thank you.

 

argV

 

Here is a sample program something along lines of what you talking about. This program inserts a block built into the program. After the insertion the dialog reappears. Same principle. You can review this to see how to make the dialog loop.

SL.zip

Posted
I think there is enough that we can provide ample help and advice :)

 

Hence my 2 pargraph respone, But its easyer to him to post some thing he's faminlar and we offer a possible way, instead of showing him code that is unfamilar and try and understand it then applie the same princables., @ least i do

Posted
The done_dialog function can be assigned an exit flag which can be any integer (except 0 and 1, these are reserved for the Accept and Cancel tiles).

 

This flag can be retrieved from the start_dialog function:

 

(setq flag (start_dialog))

See here for more:

 

http://www.afralisp.net/lispa/lisp43b.htm

 

You know thats funny because I came strait from that very link to here because I just couldn't get my mind around the way it works.

 

I was trying to modify my code to similar to that code there, but it wasn't working so I thought I'd ask here. :)

 

Well I'll keep banging away at it, and look at 'the buzzards' code. Sometimes simple concepts are the most difficult for me!

 

thanks,

 

ArgV

Posted
Here is a sample program something along lines of what you talking about. This program inserts a block built into the program. After the insertion the dialog reappears. Same principle. You can review this to see how to make the dialog loop.

 

 

That is some elegant code! However, a little long for what I'm looking for. I just want to really know:

 

How do I, upon pressing a button (action_tile) get the dialog to go away.

How do I, upon selecting a block, make the tile re-appear again?

 

I've tried some things, but I can't get it to go away. Is it unload_dialog that is supposed to do it? If so, it's not working or I probably have a mistake somewhere.

 

thanks,

 

ArgV

Posted

Umm Basicly

 

You carnt hide a dcl box,

"hiding" refers to closing the window, do some stuff the open again, and put data back.

 

So basicly you shut it, same as the accept or cancel button.

Put in a flag, so that you know it hasnt shut,

Do what you need.

The open it again.

 

So you want to

1. open diaglogue

2. click button

3. close dialouge

4. Select block

Then go back to 1.

Posted
Hence my 2 pargraph respone, But its easyer to him to post some thing he's faminlar and we offer a possible way, instead of showing him code that is unfamilar and try and understand it then applie the same princables., @ least i do

 

 

Really I would rather just have an explanation, such as "well in order to get the dialog to go away, you have to ______________ because otherwise it doesn't know that you are done with it until you ___________________ and to get it back you have to _______________________. Oh, and it should probably be inside of a loop...

 

.. or whatever..

 

Thanks.

 

-ArgV

Posted

 

How do I, upon pressing a button (action_tile) get the dialog to go away. ArgV

 
(action_tile "Name_of_button"" (setq someflag 2)(done_dialouge)")

How do I, upon selecting a block, make the tile re-appear again?

 
(cond 
((someflag 2)
(setq blocknamestorage (car (entsel))
(place a link but  to what open the dialogue box  the first time))
)

Posted
Umm Basicly

 

You carnt hide a dcl box,

"hiding" refers to closing the window, do some stuff the open again, and put data back.

 

So basicly you shut it, same as the accept or cancel button.

Put in a flag, so that you know it hasnt shut,

Do what you need.

The open it again.

 

So you want to

1. open diaglogue

2. click button

3. close dialouge

4. Select block

Then go back to 1.

 

Perhaps I should be more clear.

 

I'm making a routine in which you select a block you want to rename. Once you select the block, a DCL comes up with the block name so you can just change a few characters and hit ok, and it re-names. But suppose you want to rename the block similar to another block in the drawing, so I put a button that says "Like..." and that button should hide the dialog, let the user choose a block that has similar name (or even way different, doesn't matter) and then have the dialog come up, only having the newly picked block name in the text box, instead of the original pick, and then you can modify the name from there.

 

thanks,

 

ArgV

Posted

Sorry, this is why im not a teacher, carnt explain ****.

 

So you already have a blocks name (BlkNam), when you pass it the dcl.

 

 
(StartDcl) ; will start the dcl the ussual crap, (which sound liike you know)
(set_tile "Someeditbox" BlkNam)
(action_tile "SelectNewBlock" "(setq flager 2) (done_dialouge) ")
(action_tile "accept" "(setq flager 1)(getstuff such as needed ) (done_dialouge)")
(action_tile "cancel" (setq flager 0) (done_dialouge))

(enddcl) ;you know that with the unload_dilogue

(while (not (>= flager 1)
(cond 
((= flager 3)
(setq BlkName (car (entsel))
)
);end cond
;With the new block name go back to 
(startdcl)
);endwhile

 

 

 

 

 

 

real life example

(defun beamdio ()
  (setq dialo (load_dialog "MainDCL"))
  (if (not (new_dialog "Pfcbox" dialo)) (exit))
  (start_list "beamtype")    
   (mapcar 'add_list pfcsizes)    
  (end_list)
  (if (not sectiontype)

   (set_tile "beamtype" sectiontype)
  )
  (if (not sectionlength)
   (set_tile "length" sectionlength)
  )
  (if (not bendradius)
   (set_tile "rolled" bendradius)
  )
  (if (not roangle )
   (set_tile "angle" roangle)
  )
  (if toetoggle (set_tile "toetrim" (itoa toetoggle)))
  ;what to do settings
  (action_tile "toetrim" "(if (= toetoggle 1)(setq toetoggle 0)(setq toetoggle 1))")
  (action_tile "cancel" "(setq ok 0)(done_dialog)(exit)")
  (action_tile "accept" "(setq ok 1)
   (setq sectiontype (strcase(get_tile \"beamtype\")))
   (setq sectionlength (strcase(get_tile \"length\")))
   (setq bendradius (strcase(get_tile \"rolled\")))
   (setq roangle (strcase(get_tile \"angle\")))     
   (done_dialog)"
  )
  (action_tile "lengthget" "(setq ok 4) 
   (setq sectiontype (strcase(get_tile \"beamtype\")))
   (setq sectionlength (strcase(get_tile \"length\")))
   (setq bendradius (strcase(get_tile \"rolled\")))
   (setq roangle (strcase(get_tile \"angle\")))
   (done_dialog)"
  )
  (action_tile "rolledidget" "(setq ok 5) 
   (setq sectiontype (strcase(get_tile \"beamtype\")))
   (setq sectionlength (strcase(get_tile \"length\")))
   (setq bendradius (strcase(get_tile \"rolled\")))
   (setq roangle (strcase(get_tile \"angle\")))
   (done_dialog)"
  )
  (action_tile "angleget" "(setq ok 6) 
   (setq sectiontype (strcase(get_tile \"beamtype\")))
   (setq sectionlength (strcase(get_tile \"length\")))
   (setq bendradius (strcase(get_tile \"rolled\")))
   (setq roangle (strcase(get_tile \"angle\")))
   (done_dialog)"
  )
  (start_dialog)
  (unload_dialog dialo)
 )
 (beamdio)
 (while (not (or (= ok 0)(= ok 1)))
 (cond
  ((= ok 4)
   (setq sectionlength (rtos  (getdist "\nWhat is the Length")2 0)
    bendradius ""
    bendangle "")      
  )
  ((= ok 5)
   (setq bendradius (rtos (getdist "\nWhat is the radius of in inside:")2 0)
    sectionlength (rtos  (* pi (atof bendradius) 2)2 0)
    bendangle "")       

  )
  ((= ok 6)
   (setq bendangle (anglefinder)
    sectionlength (rtos  (* (atof sectionlength) (/ (atof bendangle) 360.00))2 0))
   (if (not (= bendangle 360))
    (setq rord "I/R")) 

 )
)
  (beamdio)  
 )

 

Make better sence?

Posted

Uhh dude woot?

I dont even know what your trying to taking offence at

 

1.It wasnt directed @ you,

2. I made now comment to you on this thread what so ever.

 

3.It was aimed at lee, meerling explaining my comment of why i said what i said.

 

Which is , if the user posted his programming for the dcl.

It would be far easyer to mark up (more than likey just put a loop & flag in), which he would understand better because he is familar with his code.

Than what i posted, which would make less sence because he is unfamilar with my code & how i do things.

BUT again, At least I BELIVE that is the easyest way most times,particularly when an example is best to explain things.However of cource we can answer it with out,Which we did, and i think it did cause some confustion, But then again i do not explain things well many times.

 

 

Flower

Posted
Uhh dude woot?

I dont even know what your trying to taking offence at

 

1.It wasnt directed @ you,

2. I made now comment to you on this thread what so ever.

 

3.It was aimed at lee, meerling explaining my comment of why i said what i said.

 

Which is , if the user posted his programming for the dcl.

It would be far easyer to mark up (more than likey just put a loop & flag in), which he would understand better because he is familar with his code.

Than what i posted, which would make less sence because he is unfamilar with my code & how i do things.

BUT again, At least I BELIVE that is the easyest way most times,particularly when an example is best to explain things.However of cource we can answer it with out,Which we did, and i think it did cause some confustion, But then again i do not explain things well many times.

 

 

Flower

 

It's all good y'all. I got more than I expected out of this thread, which is why I like this forum. Many times I ask a question WHILE I'm working on the code, so that, if I can't figure it out, I come back and someone (or some people) who knows more than me has answered my question.

 

I'm relatively new to the whole LISP language, only been using it for about 1.5 years off and on, but more on now than ever before. I took some C classes, and am going to take more in the future, but right now I just look for alot of help from people who have "been there, done that", so to speak..

 

I am very grateful for everyones contribution, and have read all posts. It's nice to also have people explain things different ways, as thats how we learn about other people, and their learning style.

 

-ArgV

Posted

Mate you welcome.

You have being coding longer than i have (dec last year).

thought about doing c aswell looks quite nice, and can do so much more with it, But think will stick with lisp learn than a bit more, like they say, learn one laungaue and you can learn them all

 

Enjoy

 

Flower!

Posted
Mate you welcome.

You have being coding longer than i have (dec last year).

thought about doing c aswell looks quite nice, and can do so much more with it, But think will stick with lisp learn than a bit more, like they say, learn one laungaue and you can learn them all

 

Enjoy

 

Flower!

 

Actually I had never even touched autocad 2 years ago, and now I've written a whole crapload of routines and a menu system for my work which led to a pretty nice position. :)

 

 

C is a great language, since it's small, fast, and makes sense. And yes, once you learn the basics of programming languages.. looping, variables, data types, objects, methods, properties etc etc, the rest is just learning the syntax of each language. LISP for some reason is more difficult than other languages for me. The only real difference is in LISP you use a list instead of an array. (of course you can use VLISP and use an array).

 

Cheers, and thanks.

 

-ArgV

Posted
I had never even touched autocad 2 years ago

Yer same boat,well did a cource but that dosnt count. And already i hate the bustard of a program ;(

 

Tho ive create some time saving routines, by boss will not admit to my knowledge hence the crew using it behind his back, and i look like a time waster :P

 

Mmm array's & points, Something i havnt completly understood yet, tho time dosnt permit me learing the sweat langaue :(

Posted
 
(action_tile "Name_of_button"" (setq someflag 2)(done_dialouge)")

 
(cond 
((someflag 2)
(setq blocknamestorage (car (entsel))
(place a link but  to what open the dialogue box  the first time))
)

 

You don't need to manually set the flag, just assign an exit value to the (done_dialog) statement:

 

(done_dialog 2)

Then you can collect this value from the (start_dialog) function:

 

(setq flag (start_dialog))

 

The "accept" and "cancel" tiles should be defined using 1 & 0 respectively.

 

The basic structure of the code needs to be something like this:

 

(setq dcTag (load_dialog "DCL-Example.dcl")) 

 ;;  Begin DCL Loop
 (while (not (vl-position flag '(0 1)))

   ;; Load Dialog
   (or (new_dialog "DCL-Dialog" dcTag)
       (alert "Error Loading Dialog.")
       (exit))

   (action_tile "pick_blk"  "(done_dialog 2)") ; Set ending value
   (action_tile "accept"    "(done_dialog)")
   (action_tile "cancel"    "(done_dialog)")

   ;; Collect Flag
   (setq flag (start_dialog))

   (if (eq flag 2) (blk_pick))) ; Run program to pick block
   ;;  End DCL Loop
 
   (unload_dialog dcTag) ;; Unload after loop finished

Posted

Lee,

 

I am not sure if I did something wrong here, But trying to use your example from a practical point, I wrote it using an Afralisp function for demonstration. I had to change some naming of things as dashed line and DCL were not allowed in the coding.

 

When I run the example it works well, However when you run the program a second time you get just a nil.

 

Personally I do not see a point for selecting an object this way when it can be done after OK has been selected. Maybe I am missing something here.

 

Here is the example used to increase the size of a circle.

 

DCL

EXAMPLE : dialog {
         label = "DCL-Example";
         : column {
           : button {
             label = "Select Object";
             key = "pick_blk";
             width = 20;
             fixed_width = true;
             alignment = centered;
           }
           ok_cancel;
         }
       }

 

LSP

(defun C:EXAMPLE ()
 (setq dcTag (load_dialog "Example.dcl")) 
 ;;  Begin DCL Loop
 (while (not (vl-position flag '(0 1 3 4)))
   ;; Load Dialog
   (or (new_dialog "EXAMPLE" dcTag)
       (alert "Error Loading Dialog.")
       (exit))
   (action_tile "pick_blk"  "(done_dialog 2)") ; Set ending value
   (action_tile "accept"    "(done_dialog)(setq button T)")
   (action_tile "cancel"    "(done_dialog)(setq button nil)")
   ;; Collect Flag
   (setq flag (start_dialog))
   (if (eq flag 2) (blk_pick))) ; Run program to pick block
   ;;  End DCL Loop
   (unload_dialog dcTag) ;; Unload after loop finished
   (if button
     (blk_chg)
   )
)
(defun blk_pick ()
 (setq e (entget (car (nentsel))))
)
(defun blk_chg ()
 (setq d (assoc 40 e))
 (setq e1 (subst '(40 . 50.0) d e))
 (entmod e1)
 (command "REGEN")
)

 

What could be wrong?

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...