kurtschenk
Technical User
I am working on an SDI application where the user can enter data via a dialog box. This includes the title of the application. The title is stored in an object of the class MyDoc. The corresponding member variable is declared and initialized as follows:
CString Title;
Title = _T("My Design"
;
At the first time the document is saved, I would like the Save As dialog to suggest the contents of Title+".mag" as file name rather than "Untitled.mag". To achieve this I added the following line to MyDoc:
if (GetPathName() == ""
SetTitle(LPCTSTR(Title));
This sets the title in the MainFrame to whatever is in Title, if the document has not been saved so far. At the first call of Save or Save As the dialog suggests the proper file name. However, it only works of the title consits of a single word otherwise it just takes the first word of the title. In the above example it asks to save the document as "My.mag" instead of "My Design.mag". Why is that and is there a better way to accomplish my goal? Thanks for any suggestions.
Kurt
CString Title;
Title = _T("My Design"

At the first time the document is saved, I would like the Save As dialog to suggest the contents of Title+".mag" as file name rather than "Untitled.mag". To achieve this I added the following line to MyDoc:
if (GetPathName() == ""

This sets the title in the MainFrame to whatever is in Title, if the document has not been saved so far. At the first call of Save or Save As the dialog suggests the proper file name. However, it only works of the title consits of a single word otherwise it just takes the first word of the title. In the above example it asks to save the document as "My.mag" instead of "My Design.mag". Why is that and is there a better way to accomplish my goal? Thanks for any suggestions.
Kurt