Author Topic: Edit Notes  (Read 3656 times)

0 Members and 1 Guest are viewing this topic.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Edit Notes
« on: November 08, 2016, 12:52:53 PM »
Hi, I need help please.

I do not know how to add the content in an editbox and that appears in poppup_list  :opps:

Code - Auto/Visual Lisp: [Select]
  1. ;; DCL Temporal ---> Lee Mac
  2. (setq BiblioElecVersion "3.3")
  3.  
  4. (defun Biblock:GetSavePath ( / tmp )
  5.     (cond      
  6.         (   (setq tmp (getvar 'ROAMABLEROOTPREFIX))
  7.             (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" tmp)) "\\Support")
  8.         )
  9.         (   (setq tmp (findfile "ACAD.pat"))
  10.             (vl-string-right-trim "\\" (vl-string-translate "/" "\\" (vl-filename-directory tmp)))
  11.         )
  12.     )
  13. )
  14.  
  15. (defun _ax:start ( key lst )
  16.    (start_list key)
  17.    (mapcar 'add_list lst)
  18.    (end_list)
  19.    lst
  20. )
  21.  
  22. (defun c:L44 ( )
  23. (setq ListNotas '("Hello" "Thanks"))
  24.  
  25. ;;----------Ruta temporal y configuración DCL ---------------------------------
  26. ;; Guardamos la ruta con la funcíon (NumInc:GetSavePath)
  27. ;; Reemplzar NumInc:GetSavePath --> Biblock:GetSavePath
  28. ;;-----------------------------------------------------------------------------
  29. (setq savepath (Biblock:GetSavePath))
  30. (setq dcl (strcat savepath "\\Biblioteca_Block" (vl-string-translate "." "-" BiblioElecVersion) ".dcl"))
  31. (setq des (open dcl "w"))
  32. (foreach line
  33. '(  
  34. "ListaFolder: dialog { label = \"Listado de carpetas:\"; width=50; "
  35. "  : edit_box {key = \"key_Notas\"; edit_width = 5; fixed_width = true;}"
  36. "  : button { label = \"&Add\"; mnemonic = \"A\"; key = \"key_Add\"; fixed_width = true; } "
  37. "spacer_1; "
  38. " :list_box { key = \"key_ListNotas\"; width=30; }"
  39. "  : button { label = \" &Cancelar \"; mnemonic = \"C\"; key = \"cancel\"; fixed_width = true; is_cancel = true;} "
  40. " }  "
  41. )
  42. (write-line line des))
  43. (progn (close des) (< 0 (setq dch (load_dialog dcl))))
  44. (if (not (new_dialog "ListaFolder" dch "" (cond (*screenpointlc*) ('(-1 -1)))))
  45. (alert (strcat "\n**ERROR**"))
  46. (exit)))
  47.  
  48.  
  49. ;; Rellenar los valores del dcl
  50. (_ax:start "key_ListNotas" ListNotas)
  51.  
  52. ;;----------------------------------------------------------------
  53. (action_tile "cancel" "(setq *screenpointlc* (done_dialog 1))")
  54. (setq ddiag (start_dialog))
  55. (if (= ddiag 1) (prompt "\nPrograma Cancelado..."))
  56. (setq dch (unload_dialog dch))
  57. (if (and dcl (findfile dcl))
  58. (if (< 0 dch) (unload_dialog dch))
  59. (setvar "cmdecho" 1)
  60.  
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Edit Notes
« Reply #1 on: November 08, 2016, 02:52:12 PM »
Maybe you should study some tutorials first?:
http://web2.airmail.net/terrycad/Tutorials/MyDialogs.htm

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Edit Notes
« Reply #2 on: November 08, 2016, 03:35:59 PM »
How is it a lack of respect to provide resources that host the knowledge you seek?

That said, in addition to what roy_043 provided you may wish to read up on set_tile, get_tile, start_list, add_list, end_list and related under "Working with Programmable Dialg Boxes" in the AutoLISP Developer's Guide or the "AutoLISP Reference" if you're already a comfortable LISPer.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Edit Notes
« Reply #3 on: November 08, 2016, 04:27:45 PM »
Have I missed something? :-D

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2146
  • class keyThumper<T>:ILazy<T>
Re: Edit Notes
« Reply #4 on: November 08, 2016, 04:45:31 PM »
apparently most of us did .
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Edit Notes
« Reply #5 on: November 08, 2016, 05:04:22 PM »
He had posted "!!!!!!! Is disrespect !!" (sic) after roy_043's post.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Edit Notes
« Reply #6 on: November 08, 2016, 05:25:40 PM »
He had put "it is a lack of respect", because the answer is of no use to me.

I do not understand what the problem is and because the drama if you do not like what I say then do not read it  :devilsidesmile:
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

danallen

  • Guest
Re: Edit Notes
« Reply #7 on: November 08, 2016, 05:27:29 PM »
in my opinion, "Maybe you should study some tutorials first", is slightly disrespectful, but made up for by posting a helpful link. I might suggest rephrasing something like, "after reviewing your code, it looks like you are missing some fundamentals on DCL use, here is a good resource: (link)"
(really wordy rephrasing - and I didn't review the code as my DCL skills are lacking)

but - in my opinion the OP should also learn to not take offense at minor issues, if you are frustrated, draft your response but then sit on it for a day or few hours before posting. Focus on the positive, example someone taking the time to share a post, ignore what you perceive as small petty stuff. Focusing on the negative won't get you more help.

lastly I recognize that roy_043 posts helpful responses all the time and I don't recall any one being rude, so I assume no offense was intended

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: Edit Notes
« Reply #8 on: November 08, 2016, 05:32:37 PM »

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Edit Notes
« Reply #9 on: November 08, 2016, 05:40:50 PM »

What it tries to say in my question is that I had reached this part of the code but did not know how to do it so that when writing in the edit_box any text appearing in the poppup_list  :idea:
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

danallen

  • Guest
Re: Edit Notes
« Reply #10 on: November 08, 2016, 05:41:35 PM »
leave it to Lee Mac to say in 2 words what took me 40....

Keep cool  :-)

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: Edit Notes
« Reply #11 on: November 08, 2016, 05:49:13 PM »
What it tries to say in my question is that I had reached this part of the code but did not know how to do it so that when writing in the edit_box any text appearing in the poppup_list  :idea:

Essentially:
  • Define string-valued variable storing initial edit box value (this may be an empty string)
  • Redefine variable within action_tile statement for edit box to store edit box $value: (action_tile <edit_box> "(setq myvariable $value)")
  • Check validity of string variable within action_tile statement for 'Add' button: append to list of strings if valid and repopulate list box; else inform user if invalid
See how far you can get with those instructions, and feel free to post your new code asking for additional directions when stuck.  :-)

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2146
  • class keyThumper<T>:ILazy<T>
Re: Edit Notes
« Reply #12 on: November 08, 2016, 06:28:54 PM »

With due respect to all
Quote
Hi, I need help please.

I do not know how to add the content in an editbox and that appears in poppup_list 

This was the original  question statement.

If I had chosen to respond ( late to the party ) my  post would have been very similar to roy's.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Edit Notes
« Reply #13 on: November 08, 2016, 07:53:23 PM »
What it tries to say in my question is that I had reached this part of the code but did not know how to do it so that when writing in the edit_box any text appearing in the poppup_list  :idea:

Essentially:
  • Define string-valued variable storing initial edit box value (this may be an empty string)
  • Redefine variable within action_tile statement for edit box to store edit box $value: (action_tile <edit_box> "(setq myvariable $value)")
  • Check validity of string variable within action_tile statement for 'Add' button: append to list of strings if valid and repopulate list box; else inform user if invalid
See how far you can get with those instructions, and feel free to post your new code asking for additional directions when stuck.  :-)

Hello Lee
Find this post that helped me a lot https://www.theswamp.org/index.php?topic=51098.msg562361#msg562361, but as it was to imagine the texts that are added to poppup_list are only temporary once closed the autocad is deleted everything.
¿How can I make stored and prevent it from erasing?

Code - Auto/Visual Lisp: [Select]
  1.     ;; DCL Temporal ---> Lee Mac
  2.     (setq BiblioElecVersion "3.3")
  3.      
  4.     (defun Biblock:GetSavePath ( / tmp )
  5.         (cond      
  6.             (   (setq tmp (getvar 'ROAMABLEROOTPREFIX))
  7.                 (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" tmp)) "\\Support")
  8.             )
  9.             (   (setq tmp (findfile "ACAD.pat"))
  10.                 (vl-string-right-trim "\\" (vl-string-translate "/" "\\" (vl-filename-directory tmp)))
  11.             )
  12.         )
  13.     )
  14.      
  15.     (defun _ax:start ( key lst )
  16.        (start_list key)
  17.        (mapcar 'add_list lst)
  18.        (end_list)
  19.        lst
  20.     )
  21.  
  22.    ;; Código ---> kpblc
  23.     (defun _kpblc-list-add-or-subst (lst key value)
  24.     (if (not value)
  25.     (vl-remove-if (function (lambda (x) (= (car x) key))) lst)
  26.       (if (cdr (assoc key lst))
  27.         (subst (cons key value) (assoc key lst) lst)
  28.         (cons (cons key value)
  29.               (vl-remove-if (function (lambda (x) (= (car x) key))
  30.                                       )
  31.                             lst
  32.                             )
  33.               )
  34.         )
  35.       )
  36.     )
  37.  
  38.  
  39.      (defun c:L44 ( )
  40.  
  41.   ;; Código ---> kpblc
  42.   (defun fun_callback (key value ref-list)
  43.     (cond ((= key "key_Add")
  44.      (set ref-list
  45.       (_kpblc-list-add-or-subst (eval ref-list)
  46.                                           "key_ListNotas"
  47.                                           (append (cdr (assoc "key_ListNotas" (eval ref-list))) (list (get_tile "key_Notas")))
  48.                                           )
  49.                 ) ;_ end of set
  50.            (start_list "key_ListNotas" 3)
  51.            (mapcar (function add_list) (cdr (assoc "key_ListNotas" (eval ref-list))))
  52.            (end_list)
  53.            )
  54.           )
  55.     )
  56.      
  57.     ;;----------Ruta temporal y configuración DCL ---------------------------------
  58.     ;; Guardamos la ruta con la funcíon (NumInc:GetSavePath)
  59.     ;; Reemplzar NumInc:GetSavePath --> Biblock:GetSavePath
  60.     ;;-----------------------------------------------------------------------------
  61.     (setq savepath (Biblock:GetSavePath))
  62.     (setq dcl (strcat savepath "\\Biblioteca_Block" (vl-string-translate "." "-" BiblioElecVersion) ".dcl"))
  63.     (setq des (open dcl "w"))
  64.     (foreach line
  65.     '(  
  66.     "ListaFolder: dialog { label = \"Listado de carpetas:\"; width=50; "
  67.     "  : edit_box {key = \"key_Notas\"; edit_width = 5; fixed_width = true;}"
  68.     "  : button { label = \"&Add\"; mnemonic = \"A\"; key = \"key_Add\"; fixed_width = true; } "
  69.     "spacer_1; "
  70.     " :list_box { key = \"key_ListNotas\"; width=30; }"
  71.     "  : button { label = \" &Cancelar \"; mnemonic = \"C\"; key = \"cancel\"; fixed_width = true; is_cancel = true;} "
  72.     " }  "
  73.     )
  74.     (write-line line des))
  75.     (progn (close des) (< 0 (setq dch (load_dialog dcl))))
  76.     (if (not (new_dialog "ListaFolder" dch "(fun_callback $key $value 'dcl_lst)" (cond (*screenpointlc*) ('(-1 -1)))))
  77.     (progn
  78.     (alert "\n**ERROR**")
  79.     (exit)))
  80.      
  81.     ;;----------------------------------------------------------------
  82.     (action_tile "cancel" "(setq *screenpointlc* (done_dialog 1))")
  83.            
  84.     (_ax:start "key_ListNotas" (cdr (assoc "key_ListNotas" dcl_lst)))
  85.  
  86.     (setq ddiag (start_dialog))
  87.     (princ)
  88.     (if (= ddiag 1) (prompt "\nPrograma Cancelado..."))
  89.     (setq dch (unload_dialog dch))
  90.     (if (and dcl (findfile dcl))
  91.     (vl-file-delete dcl))
  92.     (if (< 0 dch) (unload_dialog dch))
  93.     (princ))
  94.  

<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

danallen

  • Guest
Re: Edit Notes
« Reply #14 on: November 08, 2016, 08:15:39 PM »
¿How can I make stored and prevent it from erasing?

that depends on if you want to store info in a drawing, or in a separate file so that all drawings use same info. If in the drawing, I use Tony Tanzillo's DWGVAR routine, which can be found here: http://www.verycomputer.com/9_8e8a802661b9179e_1.htm#p4

If for all drawings, depending on how much info you need to store, you could use the registry via (SETENV "yourVarName" "info") & (GETENV "yourVarName"), or you could read/write to a file, say for example using Lee Mac's utilities:
http://www.lee-mac.com/writecsv.html http://www.lee-mac.com/readcsv.html

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Edit Notes
« Reply #15 on: November 08, 2016, 08:27:53 PM »
Clarifying my question, I would like to be recorded on the system the bad thing is not to use the functions (vl-registry-write)
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Re: Edit Notes
« Reply #16 on: November 10, 2016, 12:47:31 PM »
Code - Auto/Visual Lisp: [Select]
  1.     ;; DCL Temporal ---> Lee Mac
  2.     (setq BiblioElecVersion "3.3")
  3.      
  4.     (defun Biblock:GetSavePath ( / tmp )
  5.         (cond      
  6.             (   (setq tmp (getvar 'ROAMABLEROOTPREFIX))
  7.                 (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" tmp)) "\\Support")
  8.             )
  9.             (   (setq tmp (findfile "ACAD.pat"))
  10.                 (vl-string-right-trim "\\" (vl-string-translate "/" "\\" (vl-filename-directory tmp)))
  11.             )
  12.         )
  13.     )
  14.      
  15.     (defun _ax:start ( key lst )
  16.        (start_list key)
  17.        (mapcar 'add_list lst)
  18.        (end_list)
  19.        lst
  20.     )
  21.  
  22.    ;; Código ---> kpblc
  23.     (defun _kpblc-list-add-or-subst (lst key value)
  24.     (if (not value)
  25.     (vl-remove-if (function (lambda (x) (= (car x) key))) lst)
  26.       (if (cdr (assoc key lst))
  27.         (subst (cons key value) (assoc key lst) lst)
  28.         (cons (cons key value)
  29.               (vl-remove-if (function (lambda (x) (= (car x) key))
  30.                                       )
  31.                             lst
  32.                             )
  33.               )
  34.         )
  35.       )
  36.     )
  37.  
  38.   ;; Código ---> kpblc
  39.   (defun fun_callback (key value ref-list)
  40.     (cond ((= key "key_Add")
  41.      (set ref-list
  42.       (_kpblc-list-add-or-subst (eval ref-list)
  43.                                           "key_ListNotas"
  44.                                           (append (cdr (assoc "key_ListNotas" (eval ref-list))) (list (get_tile "key_Notas")))
  45.                                           )
  46.                 ) ;_ end of set
  47.            (start_list "key_ListNotas" 3)
  48.            (mapcar (function add_list) (cdr (assoc "key_ListNotas" (eval ref-list))))
  49.            (end_list)
  50.            )
  51.           )
  52.     )
  53.  
  54.      (defun StringListRegistryWrite (regKey valName lst)
  55.   (read
  56.       regKey
  57.       valName
  58.       (if lst
  59.         (vl-prin1-to-string lst)
  60.         ""
  61.       )
  62.     )
  63.   )
  64. )
  65.  
  66. (defun StringListRegistryRead (regKey valName)
  67.   (read
  68.     (cond
  69.       ((vl-registry-read regKey valName))
  70.       ("")
  71.     )
  72.   )
  73. )
  74.  
  75.      
  76.     (defun c:L44 (/ Maestrokey2 )
  77.      (vl-load-com)
  78.    (setq Maestrokey22 (StringListRegistryRead "HKEY_CURRENT_USER\\SOFTWARE\\Maestrokey2" "Maestrokey22"))
  79.     ;;----------Ruta temporal y configuración DCL ---------------------------------
  80.     ;; Guardamos la ruta con la funcíon (NumInc:GetSavePath)
  81.     ;; Reemplzar NumInc:GetSavePath --> Biblock:GetSavePath
  82.     ;;-----------------------------------------------------------------------------
  83.     (setq savepath (Biblock:GetSavePath))
  84.     (setq dcl (strcat savepath "\\Biblioteca_Block" (vl-string-translate "." "-" BiblioElecVersion) ".dcl"))
  85.     (setq des (open dcl "w"))
  86.     (foreach line
  87.     '(  
  88.     "ListaFolder: dialog { label = \"Listado de carpetas:\"; width=50; "
  89.     "  : edit_box {key = \"key_Notas\"; edit_width = 5; fixed_width = true;}"
  90.     "  : button { label = \"&Add\"; mnemonic = \"A\"; key = \"key_Add\"; fixed_width = true; } "
  91.     "spacer_1; "
  92.     " :list_box { key = \"key_ListNotas\"; width=30; }"
  93.     "  : button { label = \" &Cancelar \"; mnemonic = \"C\"; key = \"cancel\"; fixed_width = true; is_cancel = true;} "
  94.     " }  "
  95.     )
  96.     (write-line line des))
  97.     (progn (close des) (< 0 (setq dch (load_dialog dcl))))
  98.     (if (not (new_dialog "ListaFolder" dch  "(fun_callback $key $value 'dcl_lst)" (cond (*screenpointlc*) ('(-1 -1)))))
  99.     (progn
  100.     (alert "\n**ERROR**")
  101.     (exit)))
  102.  
  103.  
  104.     ;;----------------------------------------------------------------
  105.     (action_tile "cancel" "(setq *screenpointlc* (done_dialog 1))")
  106.  
  107.     (_ax:start "key_ListNotas" (StringListRegistryWrite "HKEY_CURRENT_USER\\SOFTWARE\\Maestrokey2" "Maestrokey22" (cdr (assoc "key_ListNotas" dcl_lst))))
  108.     (setq ddiag (start_dialog))
  109.     (princ)
  110.     (if (= ddiag 1) (prompt "\nPrograma Cancelado..."))
  111.     (setq dch (unload_dialog dch))
  112.     (if (and dcl (findfile dcl))
  113.     (vl-file-delete dcl))
  114.     (if (< 0 dch) (unload_dialog dch))
  115.     (setvar "cmdecho" 1)
  116.     (princ))
  117.  
  118.  
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>