Author Topic: Double Click in a List_Box  (Read 13377 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Double Click in a List_Box
« Reply #15 on: September 09, 2009, 01:15:19 PM »
Andrea, is ObjectDCL part of your company?

Yes,..OpenDCL is a derivate product of ObjectDCL (the original)
Keep smile...

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Double Click in a List_Box
« Reply #16 on: September 09, 2009, 01:32:14 PM »
OpenDCL is very easy to learn.  Great support over at OpenDCL.com at the discussion forums and lots of tutorials and examples.  The team is dedicated to keeping it in continual development.  And it's free.  Do a search here - I've posted some stuff.  Defenitely check it out.

jb
James Buzbee
Windows 8

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #17 on: September 09, 2009, 01:33:04 PM »
Thanks mate,

Will definitely check it out.

I see quite a few downloads on the OpenDCL site, should I get:  OpenDCL.Runtime.6.0.0.3.msi?

Crank

  • Water Moccasin
  • Posts: 1503
Re: Double Click in a List_Box
« Reply #18 on: September 09, 2009, 01:57:56 PM »
[...] should I get:  OpenDCL.Runtime.6.0.0.3.msi?
You need OpenDcl.Studio
Vault Professional 2023     +     AEC Collection

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #19 on: September 09, 2009, 02:02:59 PM »
Ahh... thanks Mr Crank  :-)

johnson

  • Guest
Re: Double Click in a List_Box
« Reply #20 on: May 04, 2011, 12:04:40 PM »
Haven't tried your most recent post yet - but I had a dabble with this:

Code: [Select]
(defun c:test (/ mylist dcl_id ptr acptr)
  (createleemacdialog)
  (setq dcl_id (load_dialog (strcat (getvar "SAVEFILEPATH") "test.dcl")))
  (if (not (new_dialog "test" dcl_id))
    (exit)
  )
  (setq mylist (list "Electrical" "Structural" "Plumbing" "Foundation"))
  (start_list "LB1" 3)
  (mapcar 'add_list mylist)
  (end_list)

  (action_tile "accept" "(or (and acPtr
                                  (not (alert (nth (atoi acPtr) mylist)))
                                  (not (setq acPtr nil)))
                             (done_dialog))")
  (action_tile "LB1"    "(or (and (eq ptr $value)
                                  (not (setq acPtr ptr ptr nil)))
                             (setq ptr $value))")
  (action_tile "cancel" "(done_dialog)")

  (start_dialog)
  (unload_dialog dcl_id)
  (princ)
)




(defun createleemacdialog (/ dialf)
  (setq dialf (open (strcat (getvar "SAVEFILEPATH") "test.dcl") "w"))
  (write-line
    "test  : dialog {
          label = \"test double click\" ;

: column {
: spacer {}

: boxed_column {
: spacer {}

label = \"ListBox :\";
 

: list_box {
        key = \"LB1\";
        allow_accept = true;
        }


}

: spacer {}

        : text {     
        label = \"For LeeMac + Andrea Only ! ;-)\";
        }
        : row {
  children_alignment =
      }


}
: spacer {}

        ok_cancel ;

 }

"   dialf
  )
  (close dialf)
)


nice one.we can use command also?lee....like copy text(replaced by that "Electrical" "Structural" "Plumbing" "Foundation")  double click means copy commend should active.....possible?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #21 on: May 04, 2011, 12:15:11 PM »
nice one.we can use command also?lee....like copy text(replaced by that "Electrical" "Structural" "Plumbing" "Foundation")  double click means copy commend should active.....possible?

Many things are possible.  :-)

johnson

  • Guest
Re: Double Click in a List_Box
« Reply #22 on: May 04, 2011, 08:49:19 PM »
nice one.we can use command also?lee....like copy text(replaced by that "Electrical" "Structural" "Plumbing" "Foundation")  double click means copy commend should active.....possible?

Many things are possible.  :-)

can you say for sample?i have tried with this.but this one autocad alert box.so command is not support.

Stefan

  • Bull Frog
  • Posts: 319
  • The most I miss IRL is the Undo button
Re: Double Click in a List_Box
« Reply #23 on: May 05, 2011, 02:52:06 AM »
Hi Lee
I just saw how old is original post... sorry if it is not actual anymore

Anyway, another method for double-click for your example

Code: [Select]
  (action_tile "accept" "(done_dialog)")
  (action_tile "LB1"    "(if (= $reason 4)
                               (alert (nth (atoi $value) mylist))
                               (setq ptr $value))")
  (action_tile "cancel" "(done_dialog)")

Note that is working no matter how allow_accept is set..


Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #24 on: May 05, 2011, 08:02:40 AM »
Code: [Select]
(= $reason 4)

How could I have missed that all this time...

Thanks phanaem, appreciated.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #25 on: May 05, 2011, 08:29:17 AM »
nice one.we can use command also?lee....like copy text(replaced by that "Electrical" "Structural" "Plumbing" "Foundation")  double click means copy commend should active.....possible?

Many things are possible.  :-)

can you say for sample?i have tried with this.but this one autocad alert box.so command is not support.

The functionality you are looking for could probably be achieved using the allow_accept attribute, since the command would be started using the same action as the accept tile.

Example:
Code: [Select]
([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] *error* coms dch file ok tmp )
 
  [color=GREEN];;----------------------------------------------;;[/color]
  [color=GREEN];; Example by Lee Mac 2011  -  www.lee-mac.com  ;;[/color]
  [color=GREEN];;----------------------------------------------;;[/color]

  ([color=BLUE]defun[/color] *error* ( msg )
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] dch ([color=BLUE]<[/color] 0 dch)) ([color=BLUE]unload_dialog[/color] dch))
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] tmp ([color=BLUE]setq[/color] tmp ([color=BLUE]findfile[/color] tmp))) ([color=BLUE]vl-file-delete[/color] tmp))   
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] msg ([color=BLUE]not[/color] ([color=BLUE]wcmatch[/color] ([color=BLUE]strcase[/color] msg) [color=MAROON]"*BREAK,*CANCEL*,*EXIT*"[/color])))
      ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\n** Error: "[/color] msg [color=MAROON]" **"[/color]))
    )
    ([color=BLUE]princ[/color])
  )

  ([color=BLUE]setq[/color] coms
   '(
      [color=MAROON]"LINE"[/color]
      [color=MAROON]"CIRCLE"[/color]
      [color=MAROON]"ELLIPSE"[/color]
      [color=MAROON]"XLINE"[/color]
      [color=MAROON]"PLINE"[/color]
      [color=MAROON]"POLYGON"[/color]
      [color=MAROON]"ARC"[/color]
      [color=MAROON]"POINT"[/color]
    )
  )

  ([color=BLUE]cond[/color]
    (
      ([color=BLUE]not[/color]
        ([color=BLUE]and[/color] ([color=BLUE]setq[/color] file ([color=BLUE]open[/color] ([color=BLUE]setq[/color] tmp ([color=BLUE]vl-filename-mktemp[/color] [color=BLUE]nil[/color] [color=BLUE]nil[/color] [color=MAROON]".dcl"[/color])) [color=MAROON]"w"[/color]))
          ([color=BLUE]progn[/color]
            ([color=BLUE]write-line[/color]
              ([color=BLUE]strcat[/color]
                [color=MAROON]"com : dialog { label = \"Commands\"; spacer; "[/color]
                [color=MAROON]"  : list_box { key = \"lst\"; alignment = centered; allow_accept = true; } ok_cancel; }"[/color]
              )
              file
            )
            ([color=BLUE]<[/color] 0 ([color=BLUE]setq[/color] file ([color=BLUE]close[/color] file) dch ([color=BLUE]load_dialog[/color] tmp)))
          )
          ([color=BLUE]new_dialog[/color] [color=MAROON]"com"[/color] dch)
        )
      )
      ([color=BLUE]princ[/color] [color=MAROON]"\n--> Error Loading Dialog."[/color])
    )
    ([color=BLUE]t[/color]
      ([color=BLUE]start_list[/color] [color=MAROON]"lst"[/color])
      ([color=BLUE]mapcar[/color] '[color=BLUE]add_list[/color] ([color=BLUE]setq[/color] coms ([color=BLUE]acad_strlsort[/color] coms))) ([color=BLUE]end_list[/color])

      ([color=BLUE]setq[/color] *com ([color=BLUE]set_tile[/color] [color=MAROON]"lst"[/color] ([color=BLUE]cond[/color] ( *com ) ( [color=MAROON]"0"[/color] ))))
      ([color=BLUE]action_tile[/color] [color=MAROON]"lst"[/color] [color=MAROON]"(setq *com $value)"[/color])

      ([color=BLUE]setq[/color] ok ([color=BLUE]start_dialog[/color]))
    )
  )

  (*error* [color=BLUE]nil[/color])
  ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ok) ([color=BLUE]command[/color] ([color=BLUE]strcat[/color] [color=MAROON]"_."[/color] ([color=BLUE]nth[/color] ([color=BLUE]atoi[/color] *com) coms))))
  ([color=BLUE]princ[/color])
)

johnson

  • Guest
Re: Double Click in a List_Box
« Reply #26 on: May 05, 2011, 11:02:32 AM »
nice one.we can use command also?lee....like copy text(replaced by that "Electrical" "Structural" "Plumbing" "Foundation")  double click means copy commend should active.....possible?

Many things are possible.  :-)

can you say for sample?i have tried with this.but this one autocad alert box.so command is not support.

The functionality you are looking for could probably be achieved using the allow_accept attribute, since the command would be started using the same action as the accept tile.

Example:
Code: [Select]
([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] *error* coms dch file ok tmp )
 
  [color=GREEN];;----------------------------------------------;;[/color]
  [color=GREEN];; Example by Lee Mac 2011  -  www.lee-mac.com  ;;[/color]
  [color=GREEN];;----------------------------------------------;;[/color]

  ([color=BLUE]defun[/color] *error* ( msg )
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] dch ([color=BLUE]<[/color] 0 dch)) ([color=BLUE]unload_dialog[/color] dch))
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] tmp ([color=BLUE]setq[/color] tmp ([color=BLUE]findfile[/color] tmp))) ([color=BLUE]vl-file-delete[/color] tmp))   
    ([color=BLUE]if[/color] ([color=BLUE]and[/color] msg ([color=BLUE]not[/color] ([color=BLUE]wcmatch[/color] ([color=BLUE]strcase[/color] msg) [color=MAROON]"*BREAK,*CANCEL*,*EXIT*"[/color])))
      ([color=BLUE]princ[/color] ([color=BLUE]strcat[/color] [color=MAROON]"\n** Error: "[/color] msg [color=MAROON]" **"[/color]))
    )
    ([color=BLUE]princ[/color])
  )

  ([color=BLUE]setq[/color] coms
   '(
      [color=MAROON]"LINE"[/color]
      [color=MAROON]"CIRCLE"[/color]
      [color=MAROON]"ELLIPSE"[/color]
      [color=MAROON]"XLINE"[/color]
      [color=MAROON]"PLINE"[/color]
      [color=MAROON]"POLYGON"[/color]
      [color=MAROON]"ARC"[/color]
      [color=MAROON]"POINT"[/color]
    )
  )

  ([color=BLUE]cond[/color]
    (
      ([color=BLUE]not[/color]
        ([color=BLUE]and[/color] ([color=BLUE]setq[/color] file ([color=BLUE]open[/color] ([color=BLUE]setq[/color] tmp ([color=BLUE]vl-filename-mktemp[/color] [color=BLUE]nil[/color] [color=BLUE]nil[/color] [color=MAROON]".dcl"[/color])) [color=MAROON]"w"[/color]))
          ([color=BLUE]progn[/color]
            ([color=BLUE]write-line[/color]
              ([color=BLUE]strcat[/color]
                [color=MAROON]"com : dialog { label = \"Commands\"; spacer; "[/color]
                [color=MAROON]"  : list_box { key = \"lst\"; alignment = centered; allow_accept = true; } ok_cancel; }"[/color]
              )
              file
            )
            ([color=BLUE]<[/color] 0 ([color=BLUE]setq[/color] file ([color=BLUE]close[/color] file) dch ([color=BLUE]load_dialog[/color] tmp)))
          )
          ([color=BLUE]new_dialog[/color] [color=MAROON]"com"[/color] dch)
        )
      )
      ([color=BLUE]princ[/color] [color=MAROON]"\n--> Error Loading Dialog."[/color])
    )
    ([color=BLUE]t[/color]
      ([color=BLUE]start_list[/color] [color=MAROON]"lst"[/color])
      ([color=BLUE]mapcar[/color] '[color=BLUE]add_list[/color] ([color=BLUE]setq[/color] coms ([color=BLUE]acad_strlsort[/color] coms))) ([color=BLUE]end_list[/color])

      ([color=BLUE]setq[/color] *com ([color=BLUE]set_tile[/color] [color=MAROON]"lst"[/color] ([color=BLUE]cond[/color] ( *com ) ( [color=MAROON]"0"[/color] ))))
      ([color=BLUE]action_tile[/color] [color=MAROON]"lst"[/color] [color=MAROON]"(setq *com $value)"[/color])

      ([color=BLUE]setq[/color] ok ([color=BLUE]start_dialog[/color]))
    )
  )

  (*error* [color=BLUE]nil[/color])
  ([color=BLUE]if[/color] ([color=BLUE]=[/color] 1 ok) ([color=BLUE]command[/color] ([color=BLUE]strcat[/color] [color=MAROON]"_."[/color] ([color=BLUE]nth[/color] ([color=BLUE]atoi[/color] *com) coms))))
  ([color=BLUE]princ[/color])
)



lee our lisp commands is not supporting here!!???its supporting only cad commands.why?

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #27 on: May 05, 2011, 12:49:11 PM »
lee our lisp commands is not supporting here!!???its supporting only cad commands.why?

Because the code was designed for AutoCAD commands, not LISP functions.

johnson

  • Guest
Re: Double Click in a List_Box
« Reply #28 on: May 05, 2011, 08:55:11 PM »
lee our lisp commands is not supporting here!!???its supporting only cad commands.why?

Because the code was designed for AutoCAD commands, not LISP functions.

how can modify this for lsp commands lee

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Double Click in a List_Box
« Reply #29 on: May 06, 2011, 06:39:03 AM »
lee our lisp commands is not supporting here!!???its supporting only cad commands.why?

Because the code was designed for AutoCAD commands, not LISP functions.

how can modify this for lsp commands lee

You would have to change the line:

Code: [Select]
  (if (= 1 ok) (command (strcat "_." (nth (atoi *com) coms))))
To call the LISP function instead, something like:

Code: [Select]
  (if (= 1 ok) (eval (read (strcat "(c:" (nth (atoi *com) coms) ")"))))