Page 1 of 1

Question about wxDirPickerCtrl and wxDirDialog

Posted: Wed Dec 26, 2007 4:11 am
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.

Posted: Wed Dec 26, 2007 5:28 pm
by priyank_bolia
check the fourth parameter of the wxDirPickerCtrl constructor.

Posted: Thu Dec 27, 2007 4:50 am
by zhouhao
[quote="priyank_bolia"]check the fourth parameter of the wxDirPickerCtrl constructor.[/quote]

It doesn't work. Still show "Browse" on button.

Posted: Thu Dec 27, 2007 5:36 am
by priyank_bolia
O! you mean this:

Code: Select all

m_dirPickerSrc->GetWindowChildren()[1]->SetLabel(wxT("Priyank"));

Posted: Thu Dec 27, 2007 7:48 am
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.

Posted: Thu Dec 27, 2007 7:59 am
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.

Posted: Thu Dec 27, 2007 2:12 pm
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