?
Solved

CfileDialog Text Button Change

Posted on 2003-03-11
10
Medium Priority
?
809 Views
Last Modified: 2013-11-20
Dear friends i have a great problem, I want to change the text of button Open and Cancel,
because i translate it in italian language.
I try with use the IDOK and IDCANCEL but in this way doesn't work.
I want to change the string  "File name" and "File of type" too.

tanks
Tonygnos From Italy
0
Comment
Question by:Tonygnos
  • 4
  • 3
  • 2
  • +1
10 Comments
 

Author Comment

by:Tonygnos
ID: 8112286
help me
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8112629


  One way would be to look for the window

  CWnd* pFileNameWnd = myFileDlg.FindWindow ( "static", "File name:");

  pFileNameWnd->SetWindowText ( "Itialian File Name" );

 Another way

  Each of the controls in CFileDialog has an ID
 
  So experiment
 
  CWnd *pWnd = (CWnd*)GetDlgItem ( 1 );

  if ( pWnd )
      pWnd->SetWindowText ( "Test" );

  Until you find the right ID. The RC file for common dialogs exists somewhere I cant remember where though.


 
 
0
 

Author Comment

by:Tonygnos
ID: 8118352
No, in this way doesn't work too
i'm sorry
Heeeeelp me please!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Expert Comment

by:hoabeo
ID: 8118380
I think you should create new class that derive from CFileDialog.
On the OnInitDialog function, you call the following:

CWnd* pParent = GetParent();
if (pParent)
    pParent->SetDlgItemText(nID, (LPCSTR)string);

Where nID maybe IDOK, IDCANCEL, or whatever values that you can spy from the standard FileDialog, and string is what you want to set for that control
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 8123528

 Have you tried changing to the Italian Locale?

 Maybe FileDialog already supports Italian!
0
 
LVL 1

Expert Comment

by:jadams117
ID: 8124647
I've done something similar before. As hoabeo says, you should derive a class from CFileDialog but override OnInitDone() instead of OnInitDialog()

Then you can change the text of the buttons using:
SetControlText(IDOK, _T("Italian Open"));
0
 
LVL 1

Expert Comment

by:jadams117
ID: 8124697
I just had another look and to find the identifiers for the items in the dialog, take a look at..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/aboutcommondialogboxes/openandsaveasdialogboxes.asp

There is a table of identifier names near the bottom of the article, under the title "Explorer-Style Control Identifiers"
0
 

Author Comment

by:Tonygnos
ID: 8127264
thanks to all but i resolve my problem jet.
i override OninitDialog and i use SetControlText routine.
but I have another question always on CFileDialog window : what are the ID of the text that compare when you go with the mouse on  the explorer icon(up on level,create new folder,list details) or wich kind of command i have to use to hide this function on CfileDialog?

thanks to all
0
 
LVL 1

Accepted Solution

by:
jadams117 earned 200 total points
ID: 8129406
In your derived class override OnInitDone() function and put in something like..

void CMyFileDialog::OnInitDone()
{
     // set text in buttons
     GetParent()->SetDlgItemText(IDOK, "&Hello");
     GetParent()->SetDlgItemText(IDCANCEL, "&Goodbye");

     // get pointer to toolbar containing controls at top-left of dialog
     // look up CToolBarCtrl in MSDN to see members of this object
     CToolBarCtrl *pToolBar = (CToolBarCtrl*) CWnd::FromHandle(FindWindowEx(*GetParent(), NULL, "ToolbarWindow32", NULL));

     // the IDs of the toolbar buttons are
     // 0xA001 - up one level button
     // 0xA002 - create new folde button
     // 0xA003 - list button
     // 0xA004 - details button

     // e.g. set the state of the 'create new folder' button
     pToolBar->SetState(0xA002, TBSTATE_INDETERMINATE);

     // the indices of the toolbar buttons are
     // 0 - separator
     // 1 - up one level button
     // 2 - separator
     // 3 - create new folder button
     // 4 - separator
     // 5 - list button
     // 6 - details button

     // e.g. delete all buttons
     for (int i = pToolBar->GetButtonCount(); i; i--)
          pToolBar->DeleteButton(0);
}
0
 

Author Comment

by:Tonygnos
ID: 8135342
Thanks to all but jadams117 given to me a exhaustive answer.
Great.
Thakyou very mutch
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question