Board index » cppbuilder » Changing Button Caption of a TSaveDialog Dialog?

Changing Button Caption of a TSaveDialog Dialog?


2006-07-11 03:35:05 AM
cppbuilder4
Is there a way to change the default button captions of a TSaveDialog dialog
(i.e., instead of Save/Cancel say Ok/Cancel)?
Tx,
S.
 
 

Re:Changing Button Caption of a TSaveDialog Dialog?

"SVC" < XXXX@XXXXX.COM >wrote in message
Quote
Is there a way to change the default button captions of a
TSaveDialog dialog (i.e., instead of Save/Cancel say Ok/Cancel)?
Yes. You would have to manually update the buttons directly, via the
CDM_SETCONTROLTEXT message. For example:
void __fastcall TForm1::SaveDialog1Show(TObject *Sender)
{
CommDlg_OpenSave_SetControlText(::GetParent(SaveDialog1->Handle),
IDOK, "OK");
}
Gambit
 

Re:Changing Button Caption of a TSaveDialog Dialog?

Thanks. Your suggestion works.
To get a better understanding:
1) How do I figure out the identifier of control in a dialog box?
2) CommDlg_OpenSave_SetControlText function cannot be found in the help
unlike the SetDlgItemText function, which is described in the help.
What is the difference between these two functions? The former works
with the "Save" button while the latter works only with the "cancel"
button?!?
TIA,
S.
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"SVC" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>Is there a way to change the default button captions of a
>TSaveDialog dialog (i.e., instead of Save/Cancel say Ok/Cancel)?

Yes. You would have to manually update the buttons directly, via the
CDM_SETCONTROLTEXT message. For example:

void __fastcall TForm1::SaveDialog1Show(TObject *Sender)
{
CommDlg_OpenSave_SetControlText(::GetParent(SaveDialog1->Handle),
IDOK, "OK");
}


Gambit


 

{smallsort}

Re:Changing Button Caption of a TSaveDialog Dialog?

"SVC" < XXXX@XXXXX.COM >wrote in message
Quote
How do I figure out the identifier of control in a dialog box?
Use an external program like Microsoft's Spy++ or Borland's WinSight to look
at the attributes of individual windows and controls.
Quote
CommDlg_OpenSave_SetControlText function cannot be found in the help
It is not a function. It is a macro that is defined in commdlg.h:
// lParam = pointer to a string
// wParam = ID of control to change
// return = not used
#define CDM_SETCONTROLTEXT (CDM_FIRST + 0x0004)
#define CommDlg_OpenSave_SetControlText(_hdlg, _id, _text) \
(void)SNDMSG(_hdlg, CDM_SETCONTROLTEXT, (WPARAM)_id,
(LPARAM)(LPSTR)_text)
Most macros are not documented by themselves. You have to look at the
documentation for the associated message instead, ie:
CDM_SETCONTROLTEXT Message
msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/commondialogboxreference/commondialogboxmessages/cdm_setcontroltext.asp
Quote
unlike the SetDlgItemText function, which is described in the help.
SetDlgItemText() is an actual function, not a macro.
Quote
What is the difference between these two functions?
Open/Save dialogs implement several CDM_... messages for working with their
child controls. The dialogs themselves change from one OS version to
another. The messages help maintain consistency across versions without
applications having to care what the changes are.
Gambit
 

Re:Changing Button Caption of a TSaveDialog Dialog?

Quote
1) How do I figure out the identifier of control in a dialog box?
2) CommDlg_OpenSave_SetControlText function cannot be found in
the help
unlike the SetDlgItemText function, which is described in the help.
You might care to look at some of the information I've assembled here,
home.att.net/~secondcut/bcbexam.htm
particularly
home.att.net/~secondcut/opdlgvcl.htm
Note that there's an available header, dlgs.h, used in the latter
page, which is helpful. But you also need the frequently-moved MSDN
document called "Explorer-Style Control Identifiers"
Tim