Question about wxDirPickerCtrl and wxDirDialog 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
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Question about wxDirPickerCtrl and wxDirDialog

Post by zhouhao »

My application need to open a dir. I tried wxDirDialog first. I passed wxDD_CHANGE_DIR in the constructor to it. But it doesn't work. The last opened dir can never be saved. So I changed to use wxDirPickerCtrl. It did work when I passed wxDIRP_CHANGE_DIR. The problem is I want to change the label from "Browse" to some other meaningful word in my application. It doesn't work if I use SetLabel function after the wxDirPickerCtrl object is created. Can anybody advise? Thanks.
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

check the fourth parameter of the wxDirPickerCtrl constructor.
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

[quote="priyank_bolia"]check the fourth parameter of the wxDirPickerCtrl constructor.[/quote]

It doesn't work. Still show "Browse" on button.
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

O! you mean this:

Code: Select all

m_dirPickerSrc->GetWindowChildren()[1]->SetLabel(wxT("Priyank"));
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

priyank_bolia wrote:O! you mean this:

Code: Select all

m_dirPickerSrc->GetWindowChildren()[1]->SetLabel(wxT("Priyank"));
I didn't try this. I tried this one because I though wxDirPicker itself is a control which can has a label.

Code: Select all

    m_dirPickerSrc->SetLabel(wxT("Priyank"));
Anyway I'll try your method.
zhouhao
Earned some good credits
Earned some good credits
Posts: 144
Joined: Tue Dec 06, 2005 7:02 am

Post by zhouhao »

priyank_bolia wrote:O! you mean this:

Code: Select all

m_dirPickerSrc->GetWindowChildren()[1]->SetLabel(wxT("Priyank"));
It works if I changed the array index from 1 to 0.

Thank you so much.
priyank_bolia
wxWorld Domination!
wxWorld Domination!
Posts: 1339
Joined: Wed Aug 03, 2005 8:10 am
Location: BANGALORE, INDIA
Contact:

Post by priyank_bolia »

zhouhao wrote:
priyank_bolia wrote:O! you mean this:

Code: Select all

m_dirPickerSrc->GetWindowChildren()[1]->SetLabel(wxT("Priyank"));
It works if I changed the array index from 1 to 0.

Thank you so much.
Which platform you are using, also to mention that this is not a portable way, but this is the only way. You can also iterate through the list and can check whether its a button, and then set the Label, too tiresome. #-o
Post Reply