Author Topic: How do I get a pathname back from a listbox  (Read 4717 times)

0 Members and 1 Guest are viewing this topic.

mkweaver

  • Bull Frog
  • Posts: 352
How do I get a pathname back from a listbox
« on: April 09, 2009, 09:40:01 AM »
If I use:
Code: [Select]
(dcl_SelectFiles '("Drawings|*.dwg")"Select drawing files for list" (getvar "dwgprefix"))to get a list of files they come back, as expected, with "\\" as the folder delimiter.  If I then put that list into a listbox they display with a single backslash, again, as expected.  However, if I then pull that list from the listbox, they come back into lisp with a single backslash.

If I try to write the resulting string to a text file I get single backslash delimiters.  I tried the following code to replace the singles with doubles, but if the first character in a folder name happens to be a "t" then the backslash produces a tab character :-(  Not what I wanted.
Code: [Select]
(strcat
 "\""
 (vl-list->string
   (subst (ascii "/") (ascii "\\") (vl-string->list line))
 )
 "\""
)

What am I missing here? There must be a way to do this.

Suggestions are appreciated.
Mike

owenwengerd

  • Bull Frog
  • Posts: 451
Re: How do I get a pathname back from a listbox
« Reply #1 on: April 09, 2009, 11:35:42 AM »
However, if I then pull that list from the listbox, they come back into lisp with a single backslash.

What exactly do you mean by "pull that list from the listbox"?  In lisp there is no "single backslash" in the way you use the term here.  You have either a "\\" character, or an escape character, but there is no such thing as a "\" character.  Therefore, I think the problem is further downstream.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: How do I get a pathname back from a listbox
« Reply #2 on: April 09, 2009, 01:48:32 PM »
So Owen, if he uses a call like (I'm not at my computer so the sntax may not be right):
Code: [Select]
(dcl_ListBox_GetText(dcl_ListBox_GetCurSel mySAuperCoolListbox))
will return "C://My Documents//MyDrawing.dwg"  and not "C:\My Documents\MyDrawing.dwg"?

Again I'm not at my computer so I can't test this.  Just thinking out loud.  Nothing really anything better to do anyway.
James Buzbee
Windows 8

owenwengerd

  • Bull Frog
  • Posts: 451
Re: How do I get a pathname back from a listbox
« Reply #3 on: April 09, 2009, 03:04:34 PM »
So Owen, if he uses a call like (I'm not at my computer so the sntax may not be right):
Code: [Select]
(dcl_ListBox_GetText(dcl_ListBox_GetCurSel mySAuperCoolListbox))will return "C://My Documents//MyDrawing.dwg"  and not "C:\My Documents\MyDrawing.dwg"?

Actually it will return "C:\\My Documents\\MyDrawing.dwg"

mkweaver

  • Bull Frog
  • Posts: 352
Re: How do I get a pathname back from a listbox
« Reply #4 on: April 09, 2009, 10:14:58 PM »
I'm getting the entire contents of the listbox, thus:
Code: [Select]
(dcl_Control_GetList BuildDrawingListFromTxt_Form1_lbFiles)and the only thing I need to do is wrap each line in quotes.  So, I don't have a problem (other than I thought I had a problem).

Sorry for the disturbance :oops:

Owen and team, props for your work on ODCL.  This is so much better than vanilla dcl.

Thanks,
Mike