How to change wxFilePickerCtrl's label ? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
denarced
Knows some wx things
Knows some wx things
Posts: 47
Joined: Sun Dec 04, 2011 7:25 am

How to change wxFilePickerCtrl's label ?

Post by denarced » Wed Jan 04, 2012 2:19 pm

Hello,

I can't see a place where to change the 'Browse'-label inside wxFormBuilder.
I tried the methods SetLabelText and SetLabel, no go (I wonder what they change).

Thanks in advance (thou I'll probably provide some more after a solution magically appears :D) ..

denarced
Knows some wx things
Knows some wx things
Posts: 47
Joined: Sun Dec 04, 2011 7:25 am

Re: How to change wxFilePickerCtrl's label ?

Post by denarced » Wed Jan 04, 2012 2:28 pm

This post indicates that it's OS dependent but doesn't provide a way to override it.

User avatar
doublemax
Moderator
Moderator
Posts: 15289
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to change wxFilePickerCtrl's label ?

Post by doublemax » Wed Jan 04, 2012 9:46 pm

wxFilePickerCtrl is a small helper class and apparently it doesn't provide an API to change the label.

So you have three options:
1) live with it
2) change the wxWidgets sources
3) build your own control
Use the source, Luke!

freshairfly
Earned a small fee
Earned a small fee
Posts: 21
Joined: Mon Jan 28, 2008 1:55 am

Re: How to change wxFilePickerCtrl's label ?

Post by freshairfly » Fri Jan 06, 2012 12:59 am

I agree with doublemax. I don't segguest you change the label too.
But on windows OS, maybe you could try the following code to change the label. :D :D

savePathPicker = new wxDirPickerCtrl(this, ID_AutoSavePath, wxEmptyString, _("Select a Folder"));
wxWindow* btnBrowse = FindWindowByLabel(wxT("Browse"), savePathPicker);
if (btnBrowse)
btnBrowse->SetLabel(_T("..."));

The code works for wxDirPickerCtrl on windows, I think it should also works for wxFilePickerCtrl.

denarced
Knows some wx things
Knows some wx things
Posts: 47
Joined: Sun Dec 04, 2011 7:25 am

Re: How to change wxFilePickerCtrl's label ?

Post by denarced » Sat Jan 07, 2012 9:15 am

I guess the smart play is to just leave it be.
I'll have to try freshairfly's suggestion thou; could work.

Thank you freshairfly and doublemax.

Post Reply