Beginner Question about FileDialog

Started by Fred Tomke, February 16, 2009, 08:51:24 AM

Previous topic - Next topic

Fred Tomke

Hello,

maybe I'm silly but I have a little question. Take the project file I attached. Load it into AutoCAD using

(dcl_project_load "lvman")

Let the form show:

(dcl_form_show lvman_sc_gaeb_export (getvar "DWGPREFIX") (strcat (vl-filename-base (getvar "DWGNAME")) ".d82") "Kostenschätzung D82")

As you can see, directory is correct, filename is correct, fileextension is not correctly selected.

In my opinion the D82-filetype must be selected in this case (the second file extenion). But it won't!  ??? What am I doing wrong?
Is something wrong with the filter "Leistungsbeschreibung D81|*.d81|Kostenschätzung D82|*.d82 ?

Thanks for you attention!
Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

The correct filter string should be "Leistungsbeschreibung D81|.d81|Kostenschätzung D82|.d82". However, it still does not select the file extension of the default file name that you send to it. I checked the code, and it appears to be setting everything up correctly, so this might be a quirk of the common file dialog. I will do some more investigation.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hi, Owen, in this case there is a bug in the ressource file (*.rc) of German OpenDCL Studio. There is written "AutoCAD Zeichnung|*.dwg;*.dxf|AutoLISP Datei (*.lsp,*.fas;*.vlx)|*.lsp;*.fas;*.vlx|" as standard filter. It must be wrong, too. Don't know how it looks like in the ENU release.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

I stand corrected. The filter works correctly with or without the * character.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Hello Owen,

unfortunately there must be wrong something:

If I use the filter "Leistungsbeschreibung D81|*.d81|Kostenschätzung D82|*.d82" all existing d82-files will be shown in the existing folder, when I switch between d81 and d82. But noone of the existing d82-files of the current folder will be shown if I use the filter "Leistungsbeschreibung D81|.d81|Kostenschätzung D82|.d82". Are really all dwg-file shown if you use "AutoCAD drawings|.dwg|" as filter string?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred, you're right, the * must be present. I didn't check whether it listed files, I only noticed that omitting the asterisk still put the correct extension on the filename when you select a different filter.

I did some research, and I found that you have to specify which should be the initial file type. Therefore, I've added code for Beta 8 to scan through the specified filter list and find the first filter that matches the specified filename, then set that file type as the initial file type. This results in the following code working as expected:
(dcl_form_show lvman_sc_gaeb_export (getvar "DWGPREFIX") (strcat (vl-filename-base (getvar "DWGNAME")) ".d82") "d82")

Note that the third argument to (dcl_Form_Show) has nothing to do with the file type dropdown; it only tells Windows what extension to use if the user types in a filename with no extension.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Thank you, Owen, that sounds good. Owen, is it difficult to add a method SelectFileType with the argument intFilter as integer which must be one of the filterlist (0 for the first, 1 for the second, ...)?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Fred Tomke

Yes it works now in Beta 8. But there's another question. When I resize the form the controls are not goodlooking anymore. Invoking the ForceUpdate-methode to the controls in an OnSize-event has no effect. How can I force the repainting of the form? I attach the sample file for testing.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

owenwengerd

Fred, please report the painting issue as a bug. I've taken a quick look, and I don't see any easy solution. The file dialog does some funky tricks to resize smoothly, and the transparent frame control just doesn't play nice under those circumstances. I'm afraid the only immediate solution is to not use a frame control.
Owen Wengerd (Outside The Box) / ManuSoft

Fred Tomke

Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]