Ticket #14791 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

Case sensitivity problem in wxGenericDirCtrl sample

Reported by: troelsk Owned by:
Priority: normal Milestone:
Component: samples Version: 2.9-svn
Keywords: wxGenericDirCtrl Cc:
Blocked By: Patch: no
Blocking:

Description

The dirctrl page in the widgets sample unexpectedly emits "Selected standard path and path from control do not match!" when you click one of the radio buttons. It seems that IsSameAs() treats backslash as escape. I know no good fix for this. But, in the sample, this workaround helps

if(!m_dirCtrl->GetPath().IsSameAs(path))

->

if(0 != _tcsicmp(m_dirCtrl->GetPath(), path))

Latest svn trunk, wxMSW, Unicode Debug DLL build, Win7

Attachments

dirctrlsample.patch download (1.0 KB) - added by troelsk 7 months ago.
Trunk

Change History

  Changed 7 months ago by vadz

  • status changed from new to infoneeded_new

This seems quite incredible. Could you please modify StringTestCase::Compare() in tests/strings/strings.cpp to test for this?

Changed 7 months ago by troelsk

Trunk

follow-up: ↓ 3   Changed 7 months ago by troelsk

  • keywords wxString removed
  • status changed from infoneeded_new to new
  • component changed from base to samples
  • summary changed from wxString::IsSameAs() cannot handle backslash to Case sensitivity problem in wxGenericDirCtrl sample

Right, nothing to do with backslash, just upper/lower case drive letter confusion, wxMSW. Patch added.

in reply to: ↑ 2   Changed 7 months ago by vadz

Replying to troelsk:

Right, nothing to do with backslash,

Uff, I was worried there for a moment.

just upper/lower case drive letter confusion, wxMSW. Patch added.

I'll apply it but this sample is really strange, it should at least check for the directory existence before selecting it.

  Changed 7 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [72820]) Compare file paths using wxFileName, not wxString, in the sample.

Comparing paths using wxString is a bad idea as identical paths can be seen as
mismatching because of case-only differences.

Also, don't reset wxRadioBox selection from its selection handler, this
doesn't work under e.g. wxGTK and is a bad example.

Closes #14791.

Note: See TracTickets for help on using tickets.