Author Topic: SOLVED_use filename to show in DCL list_box  (Read 1821 times)

0 Members and 1 Guest are viewing this topic.

nekonihonjin

  • Newt
  • Posts: 103
SOLVED_use filename to show in DCL list_box
« on: November 04, 2022, 02:27:40 PM »
I want to fill a list_box with the name of a file open after a hide button on dcl.
after I choose the file, I want to display the file name in the dcl but I have no idea how to convert that name to a string
(I'm following an afralisp tutorial as is, 'cause I have no idea by myself)


Code: [Select]
(setq thelist '(""))
...
setup dcl dialog
...

(start_list "csv_ensayes")
(mapcar 'add_list thelist)
(end_list)
......

(setq flag (start_dialog))
(if (= flag 4)
     (progn
     (setq fo (open (getfiled "Select CSV File" "" "csv" 16) "R"))
      (setq thelist (list "file name: " fo))
     );progn
);

this is the error I get:
; error: bad argument type: stringp #<file "F:\\the route of the file\\the file.csv">

« Last Edit: November 05, 2022, 10:50:31 AM by nekonihonjin »

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: use filename to show in DCL list_box
« Reply #1 on: November 04, 2022, 07:29:48 PM »
Post the link to the afralisp code.

If you use getfiled it returns a string so dont understand comment about convert to string.

It's hard to understand what it is your trying to do. Post some images etc.
A man who never made a mistake never made anything

nekonihonjin

  • Newt
  • Posts: 103
Re: use filename to show in DCL list_box
« Reply #2 on: November 04, 2022, 07:59:43 PM »
Post the link to the afralisp code.

If you use getfiled it returns a string so dont understand comment about convert to string.

It's hard to understand what it is your trying to do. Post some images etc.

Thank you for replying BIGAL, this is the link:
https://www.afralisp.net/dialog-control-language/tutorials/hiding-dialog-boxes-revisited-part-2.php

But I don't need the properties of an object to show in the list_box, I want the name of the CVS file to show in that space after I select it.




The variable "thelist" is supposed to take the text containing the path to the file selected with (setq fo (open (getfiled "Select CSV File" "" "csv" 16) "R")) but assigning it as a list item causes the error.
This error does not happen if I assign another text to the list as a test.
« Last Edit: November 04, 2022, 08:06:34 PM by nekonihonjin »

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: use filename to show in DCL list_box
« Reply #3 on: November 04, 2022, 11:46:56 PM »
There is no problems in inserting a default value in an edit_box use (set_tile key value), get file name 1st, then load dialog and set the tile value.
A man who never made a mistake never made anything

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: use filename to show in DCL list_box
« Reply #4 on: November 05, 2022, 03:31:30 AM »
Code: [Select]
(setq fo (getfiled "Select CSV File" "" "csv" 16))

nekonihonjin

  • Newt
  • Posts: 103
Re: use filename to show in DCL list_box
« Reply #5 on: November 05, 2022, 10:50:07 AM »
Code: [Select]
(setq fo (getfiled "Select CSV File" "" "csv" 16))

Thanks VovKa, this worked, then just open that variable later on the code.

There is no problems in inserting a default value in an edit_box use (set_tile key value), get file name 1st, then load dialog and set the tile value.


understood BIGAL, thanks.