Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update filedialog file extension filter #146

Open
thomthom opened this issue Dec 23, 2014 · 4 comments
Open

Update filedialog file extension filter #146

thomthom opened this issue Dec 23, 2014 · 4 comments

Comments

@thomthom
Copy link
Member

There appear to not be any STL file extension in the file dialog drop down list.

@jimfoltz
Copy link
Contributor

jimfoltz commented Jan 4, 2015

It would be nice if this feature was documented in the Developer docs.

@jimfoltz
Copy link
Contributor

jimfoltz commented Jan 4, 2015

I'm confused. Are you talking about UI.savepanel? If so, I don't think you can specify both a default filename and a list of extensions, can you?

@thomthom
Copy link
Member Author

thomthom commented Jan 5, 2015

Looks like you're right. :(
So the question becomes, is default filename more valuable over extension filter drop down?

I think I lean toward dropping the default filename until the API is improved. At least for SketchUp versions that support file filters.

@DanRathbun
Copy link

Except that the API issue was supposedly fixed (on the PC,) 10 months before this issue was posted (when SU 2014 M0 was released.)

In reality, the openpanel() and savepanel() leverage the same Win32 common dialog, but just change the window caption. All it does is return a pathstring or nil on cancel.

So the API docs are again wrong, as the UI::savepanel() filename argument description should mimic that of the UI::openpanel() (or refer to it.)

stlpath = UI.savepanel(
  "Save STL File",
  File::dirname(prevstl),
 "#{File::basename(prevstl)}|#{File::basename(prevstl)};|STL Files|*.stl;||"
)

That almost works, but it makes the user actually click on the stl file in the folder. (It doesn't appear in the filename textbox until the user does this.)

You could ask the user to use the default filename, or use a inputbox to get it, then use UI.select_directory to ask where to put it ? (For newer versions of SU)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants