#14791 closed defect (fixed)

Case sensitivity problem in wxGenericDirCtrl sample

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

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 (1)

dirctrlsample.patch download (992 bytes) - added by troelsk 18 months ago.
Trunk

Download all attachments as: .zip

Change History (5)

comment:1 Changed 18 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 18 months ago by troelsk

Trunk

comment:2 follow-up: Changed 18 months ago by troelsk

  • Component changed from base to samples
  • Keywords wxString removed
  • Status changed from infoneeded_new to new
  • 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.

comment:3 in reply to: ↑ 2 Changed 18 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.

comment:4 Changed 18 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(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.