Jump to content

Popup List Problem


The Buzzard

Recommended Posts

Happy New Year To All!

This is my first post at this site. I have been busy trying to get my programing right, But I am now stuck. I need some help with this program and have seen alot of great examples here. Attached are two programs SL1 & SL2. SL1 is a dialog program with a slide image_tile that changes the image when you select a symbol by way of a radio_button. This program works fine except when you have alot of symbols your dialog becomes to large. I decided to use a pop_up list to do the same thing in program SL2 which is where my problem is. I just cannot get this right. The dialog appears and disappears when activated. I would appreciate it if someone could shed some light on this. I am looking foward to posting some examples of symbols libraries in the future and it is very important to me to get past this hurdle.

 

Please note that the images are created using vector_image.

 

Any suggestions would be welcome.

Thanks,

The Buzzard

SL.zip

Link to comment
Share on other sites

In simple terms, I am just trying to get program S2 to show the image with a popup_list vs the radio_buttons in program S1.

 

Can anyone help?

Link to comment
Share on other sites

Thanks Lee Mac for responding,

 

Just place the dcl & lsp files together in the same directory and run the lsp file, it will open the dcl.

 

Buzzard

Link to comment
Share on other sites

That suprises me, I see your help and responces throughout this forum and I was under the impression that it would be a walk in the park for you.

Right now I am continuing to figure this one out, But any help would be still greatly appreciated.

 

Thanks for getting back.

The Buzzard

Link to comment
Share on other sites

That suprises me, I see your help and responces throughout this forum and I was under the impression that it would be a walk in the park for you.

 

Well, to be honest, the majority of what I know is learnt from this forum - I have really only been using LISP for about a year now, if that. - I just try to help out as much as I can to get more practice. :thumbsup:

 

But I'll have a look at your LISP and see what I can do :)

Link to comment
Share on other sites

You do great for someone with only 1 year, I ve been doing this for 3 years and have been holding my own, But we still get stuck. I hope to get thru this soon so I can share a working example.

 

Thanks Again

Link to comment
Share on other sites

You do great for someone with only 1 year, I ve been doing this for 3 years and have been holding my own, But we still get stuck. I hope to get thru this soon so I can share a working example.

 

Thanks Again

 

Thanks for your compliments, I hope we can sort your problem. :)

Link to comment
Share on other sites

Got it!

 

Thanks to hugopaulo from another site for his example. I will be posting some useful examples soon.

 

Thanks To All,

The Buzzard

 

SL2.DCL

///////////////////////////////////////////////////////////////////////////////////////
          sl2 : dialog {
                : boxed_column {
                  : image {
                    key = "im1";
                    height = 7.66;
                    fixed_height = true;
                    width = 27.92;
                    fixed_width = true;
                    alignment = centered;
                    color = 0;
                  }
                  : spacer {
                    height = 0;
                  }
                }
                : boxed_column {
                  : text {
                    value = "Symbol List:";
                  }
                  : popup_list {
                    key = "pl1";
                    value = 0;
                  }
                  : spacer {
                    height = 0;
                  }
                }
                : boxed_column {
                  : button {
                    label = "OK";
                    key = "accept";
                    mnemonic = "O";
                    is_default = true;
           }
           : button {
                    label = "Cancel";
             key = "cancel";
             mnemonic = "C";
                    is_cancel = true;
           }
                  : spacer {
                    height = 0;
                  }
                }
              }
///////////////////////////////////////////////////////////////////////////////////////

 

 

SL2.LSP

 

;;;////////////////////////////////////////////////////////////////////////////////////
;;; 01 - Start-Up Function - Program Start.                         ;Function Description
(defun C:SL2 ()                                                     ;Define function
 (SL_INPUT)                                                        ;GOTO SL_INPUT function
 (princ)                                                           ;Exit quietly
)                                                                   ;End of define function
;;;/////////////////////////////////////////////////////////////////
;;; 02 - Image Function - Show & Switch Image.                      ;Function Description
(defun SL_SI ()                                                     ;Define function

 (setq w (dimx_tile "im1")                                         ;Set X coordinate for im1
       h (dimy_tile "im1"))                                        ;Set Y coordinate for im1
 (start_image "im1")                                               ;Start image
 (fill_image 0 0 w h 0)                                            ;Fill image
 (cond                                                             ;Start of cond
   ((= CAT "0")                                                    ;CAT = $value
   (mapcar 'vector_image                                           ;Start of mapcar
     (list  80  23 136  80)
     (list   1  99  99   1)
     (list  23 136  80  80)
     (list  99  99   1   1)
     (list   7   7   7   7)
   ))                                                              ;End of CAT = $value
   ((= CAT "1")                                                    ;CAT = $value
   (mapcar 'vector_image                                           ;Start of mapcar
     (list  30  30 127 127  30)
     (list   1  98  98   1   1)
     (list  30 127 127  30  30)
     (list  98  98   1   1   1)
     (list   7   7   7   7   7)
   ))                                                              ;End of CAT = $value
 )                                                                 ;End of cond
 (end_image)                                                       ;End image
)                                                                   ;End of define function
;;;/////////////////////////////////////////////////////////////////
;;; 03 - Input Function - Symbols List Input.                       ;Function Description
(defun SL_INPUT ()                                                  ;Define function
 (setq CAT "0")                                                    ;Set CAT to "0" by default
 (setq sl_list                                                     ;Start of setq
  '("Triangle"                                                     ;Start of list
    "Square")                                                      ;End of list
 )                                                                 ;End of setq
 (setq dcl_id (load_dialog "sl2.dcl"))                             ;Load dialog
 (if                                                               ;Start of if
   (not                                                            ;Start of not
     (new_dialog "sl2" dcl_id)                                     ;Test for dialog
   )                                                               ;End of not
   (exit)                                                          ;Exit if dialog not found
 )                                                                 ;End of if
 (start_list "pl1")                                                ;Start list
 (mapcar 'add_list sl_list)                                        ;Add list
 (end_list)                                                        ;End list 
 (SL_SI)
 (action_tile "pl1"                                                ;When action_tile pl1 is selected
  "(setq CAT $value)(itoa 0)(SL_SI)")                              ;Set $value to variable CAT, Return conversion of integer, Goto SL_SI function
 (action_tile "cancel"                                             ;When Cancel button is selected
"(done_dialog)(setq button nil)")                                  ;Close dialog, Set flag to Nil
 (action_tile "accept"                                             ;When action_tile OK is selected
   (strcat                                                         ;Concatenate String
    "(progn                                                        ;Start of progn
       (setq CATEGORY (atof (get_tile \"pl1\")))"                  ;Get value from list box, Convert to real, Assign to cableline variable
      "(done_dialog)(setq button T))"))                            ;Close dialog and set flag to TRUE
 (start_dialog)                                                    ;Start dialog
 (unload_dialog dcl_id)                                            ;Unload dialog
 (if button                                                        ;Start of if button
   (progn                                                          ;Start of progn
     (setq CATEGORY (fix CATEGORY))                                ;Convert to integer
     (setq CATEGORY (nth CATEGORY sl_list))                        ;Retrieve name from list
     (cond                                                         ;Start of cond
       ((= CATEGORY "Triangle")(SL_SA))                            ;CATEGORY = Triangle, Goto SL_SA function
       ((= CATEGORY "Square")  (SL_SA))                            ;CATEGORY = Square,   Goto SL_SA function
     )                                                             ;End of cond
   )                                                               ;End of progn
 )                                                                 ;End of if button
 (princ)                                                           ;Exit quietly
)                                                                   ;End of define function
;;;/////////////////////////////////////////////////////////////////
;;; 04 ALERT Function - Symbol Alert                                ;Describe function
(defun SL_SA ()                                                     ;Define function
 (progn                                                            ;Start of progn
   (cond                                                           ;Start of cond
     ((= CATEGORY "Triangle")(ALERT "Triangle"))                   ;CATEGORY = Triangle, Display ALERT
     ((= CATEGORY "Square")  (ALERT "Square"))                     ;CATEGORY = Square,   Display ALERT
   )                                                               ;End of cond
 )                                                                 ;End of progn
 (princ)                                                           ;Exit quietly
)                                                                   ;End of define function
;;;/////////////////////////////////////////////////////////////////

Link to comment
Share on other sites

Thank You,

 

Just some trial & error to go through. I have some existing programs that I can now improve upon & share. Hope to post them soon and look foward to collabrating with you in the future.

 

Again Thanks,

The Buzzard

Link to comment
Share on other sites

As promised I am providing the attached files as a practical example for a Symbols Library. I would like to thank hugopaulo again for the help he provided to me so that I could complete this program. I kept this program as small as possible for the purpose of learning and easy editing so that it may become useful to someone. I have two (2) additional programs that are essential to edit the Symbols Library Lisp, But I will provide them at a later time. I would like to get some feedback on this program first before I go any further. The program has been formated in such a way to make it easy to read and comments have also been provided thru-out for those who may be learning or want to learn AutoLISP.

 

Note:

Please read the instructions provided in the SL.lsp file before proceeding to run the file.

So go ahead and take it for a test run, I would like to hear your comments.

SL.zip

Link to comment
Share on other sites

Hello again to all,

 

I am sorry, But I had to make some revisions to the code. Attached to the previous post is the revised version. All revisions are listed in the code header.

 

Thanks,

The Buzzard

Link to comment
Share on other sites

To All,

 

I found another bug, This time with the layers. This is why I need to here your comments. The problem has been fixed and the updated version is on post #15. I believe this should cover everything although I need you to put the program thru its paces just in case there is something I may have missed.

 

Sorry About This,

The Buzzard

Link to comment
Share on other sites

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