FileDialog quirk?

Just trying this again – can somebody tell me if I’m doing something wrong in my code? Is it a known problem? Thanks for any guidance.

Charles Hartman

···

Sorry if this is too familiar. A user just called my attention to it.

When my app starts up, it makes the user select a text file to work on:

 wildcard = "All files (*.*) | *.*"
 dlg = wx.FileDialog(self, message="Choose a plain text file",
     defaultDir=os.getcwd(), defaultFile="",
     wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR)
 if dlg.ShowModal() == wx.ID_OK:

(etc)

So it begins by looking in the app’s own directory, with either

nothing highlighted, or sometimes (?) the app itself. Moving the

highlight down the list in that directory to a text file should make

the “Open” button highlight, but it doesn’t, until the user navigates

somewhere else.

Minimal test case: the cwd contains the app, a text file, and another

folder. Clicking on (highlighting) the text file does not enable

the Open button. Highlighting the folder (which then displays its

contents in another pane to the right), and then moving the highlight

to the text file, does highlight the button.

This is Python 2.4.1, wxPython 2.6.2.1, under OS 10.4.4.

Is this known? Is there a workaround? It seems trivial to me, but the

user is always right, right?

Charles Hartman wrote:

Sorry if this is too familiar. A user just called my attention to it. When my app starts up, it makes the user select a text file to work on:

     wildcard = "All files (*.*) | *.*"
     dlg = wx.FileDialog(self, message="Choose a plain text file",
         defaultDir=os.getcwd(), defaultFile="",
         wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR)
     if dlg.ShowModal() == wx.ID_OK:
(etc)

So it begins by looking in the app's own directory, with either nothing highlighted, or sometimes (?) the app itself. Moving the highlight down the list in that directory to a text file should make the "Open" button highlight, but it doesn't, until the user navigates somewhere else.

Minimal test case: the cwd contains the app, a text file, and another folder. Clicking on (highlighting) the text file does *not* enable the Open button. Highlighting the folder (which then displays its contents in another pane to the right), and then moving the highlight to the text file, *does* highlight the button.

This is Python 2.4.1, wxPython 2.6.2.1, under OS 10.4.4.

Is this known? Is there a workaround? It seems trivial to me, but the user is always right, right?

Can you duplicate this in the demo? I can't seem to manage to do it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!