Author Topic: Cancel on getfiled  (Read 2850 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
Cancel on getfiled
« on: November 01, 2006, 08:18:53 AM »
I got a question about canceling an getfiled box.
Here is a piece of code what i got.

Code: [Select]
(SETQ route1 (getfiled "Select file" "Drawing" "dwg" 1))

but when i hit the cancel button in this dialog box or the escape button is this what the command line says:

Command:  nil; error: bad argument type: stringp nil

Can this piece of code be changed/modified so it that when i hit either the cancel or escape button  i will return to my main dialog box.?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Cancel on getfiled
« Reply #1 on: November 01, 2006, 08:26:59 AM »
The var is being set to nil in my test.
I suspect your routine is not handling that condition.
Need more of your code.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MvdP

  • Guest
Re: Cancel on getfiled
« Reply #2 on: November 01, 2006, 08:39:51 AM »
CAB here is more of my code.

Here is piece of my DCL

Code: [Select]
:button { label =  "Tekening Naam"; mnemonic = "N"; fixed_width = true; key = "path";}
:text{  key =  "route";  width = 75;fixed_width = true;}

Here is more  of my LSP

Code: [Select]
(action_tile "path" "(paden)")
(set_tile "route" route1)
(set_tile "dwgnaam" dwgnaam)


Code: [Select]
(defun paden ()
  (if (= pq20 nil)
(progn
  (setq pq12 (getvar "dwgname"))
  (setq lengte (strlen pq12))
  (if (> lengte 7)
(progn
  (setq pq00 (substr pq12 1 7))
  (WHILE (= pq00 "Drawing")
(SETQ route1 (getfiled "Select file" "Drawing" "dwg" 1))
(setq lengte (strlen route1))
(setq nwlengte (- lengte 10))
(setq pq00 (substr route1 nwlengte))
(set_tile "route" route1)
(set_tile "dwgnaam" route1)
(setq naam route1)
(SETQ pq12 nil)
  )
)
  )
)
  )
)

I hope this wil do.
« Last Edit: November 01, 2006, 08:43:47 AM by MvdP »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Cancel on getfiled
« Reply #3 on: November 01, 2006, 09:15:42 AM »
Maybe this will work for you.
Code: [Select]
(defun paden ()
  (if (= pq20 nil)
    (progn
      (setq pq12 (getvar "dwgname"))
      (setq lengte (strlen pq12))
      (if (> lengte 7)
        (progn
          (setq pq00 (substr pq12 1 7))
          (while (= pq00 "Drawing")
            (setq route1 (getfiled "Select file" "Drawing" "dwg" 1))
            (if route1
              (progn
                (setq lengte (strlen route1))
                (setq nwlengte (- lengte 10))
                (setq pq00 (substr route1 nwlengte))
                (set_tile "route" route1)
                (set_tile "dwgnaam" route1)
                (setq naam route1)
                (setq pq12 nil)
              )
              (setq pq00 nil) ; exit paden
            )
          )
        )
      )
    )
  )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MvdP

  • Guest
Re: Cancel on getfiled
« Reply #4 on: November 01, 2006, 09:23:58 AM »
Yes CAB it is working.You're a lifesaver.
Thank you so much.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Cancel on getfiled
« Reply #5 on: November 01, 2006, 09:37:03 AM »
You're welcome, any time.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.