If you want to restrict the file types that someone can see you just need to set the file filter string as shown below. Note that the first type in the filter string gets shown as default. This stops someone from browsing all but the file extensions you include in the filter, it does not prevent them from typing in a different filenale.ext though. If you wanted to be double sure that only files of a certain type are opened, say if you had some sort of custom machine, then you could use something like 'string.gmatch' to find the extension type and compare it to your allowed types.
I build a controller for a specialized machine that currently runs with a custom screen set on Mach3. For a machine like this being able to lock down what could be loaded and where it can be loaded from would be a good thing.
local inst = mc.mcGetInstance();
local myGCodePath = "C:/Mach3/GCode";
local fileDialog = wx.wxFileDialog(wx.NULL, "Open file", myGCodePath,
"", "NC files (*.nc)|*.nc|TAP files (*.tap)|*.tap", wx.wxFD_DEFAULT_STYLE);
local result = false;
if fileDialog:ShowModal() == wx.wxID_OK then
local fileName = fileDialog:GetPath();
result = mc.mcCntlLoadGcodeFile(inst, fileName);
if not result then
wx.wxMessageBox("Sorry, I could not open file.");
end
end