UNTITLED vs TITLED with OnFileNew()
Praveen -- msa3431@msbg.med.ge.com Tuesday, July 23, 1996 Hi, Environment : MS-Windows 3.1 and Visual C++ 1.50 In response to FILE/NEW, i am bringing up a list of TEMPLATES (files) to be opened. After the selection i am displaying the text in the TEMPLATE (file) in a CEditView window. In CMyDocument::OnNewDocument, i am changing the default caption (UNTITLED:N) to the name of the TEMPLATE(file) selected using CMyDocument::SetTitle(????????.???). Everything seems to be working fine but when i select FILE/SAVE, neither it brings up the "File Save As" dialog box for saving the template into a new file NOR it saves the text into the file name specified on the caption. After some investigation i came to know that the change of caption from UNTITLED:N to TITLED (name of the template file) is causing the problem. If i comment out this (CMyDocument::SetTitle(???????.???)) it brings up the "File Save As" when FILE/SAVE is selected and saves the TEMPLATE into the new file. FYI, the string table entry for IDR_MYDOCUMENTTYPE contains "UNTITLED:" and also tried by changing this to NULL and set the caption to the name of the TEMPLATE using CMyDocument::SetTitle(????????.???). I have to change the caption from UNTITLED:N to TITLED (????????.???). It is my clients requirement. Can any one help me in this regard. Any help will be GREATLLY APPRECIATED. Thanks Praveen
Anujit Sarkar -- anujit@vedika.ernet.in Monday, July 29, 1996 [Mini-digest: 2 responses] > Hi, > > Environment : MS-Windows 3.1 and Visual C++ 1.50 > > In response to FILE/NEW, i am bringing up a list of TEMPLATES > (files) to be opened. > After the selection i am displaying the text in the TEMPLATE > (file) in a CEditView > window. > > In CMyDocument::OnNewDocument, i am changing the default caption > (UNTITLED:N) to the > name of the TEMPLATE(file) selected using > CMyDocument::SetTitle(????????.???). > Everything seems to be working fine but when i select FILE/SAVE, > neither it brings up > the "File Save As" dialog box for saving the template into a new > file NOR it saves > the text into the file name specified on the caption. > > After some investigation i came to know that the change of > caption from UNTITLED:N to > TITLED (name of the template file) is causing the problem. If i > comment out this > (CMyDocument::SetTitle(???????.???)) it brings up the "File Save > As" when FILE/SAVE > is selected and saves the TEMPLATE into the new file. > > FYI, the string table entry for IDR_MYDOCUMENTTYPE contains > "UNTITLED:" and also > tried by changing this to NULL and set the caption to the name of > the TEMPLATE using > CMyDocument::SetTitle(????????.???). > > I have to change the caption from UNTITLED:N to TITLED > (????????.???). It is my > clients requirement. > > Can any one help me in this regard. Any help will be GREATLLY > APPRECIATED. > > Thanks > Praveen > > > > You can get rid of the Untitled prefix by negating the FWS_ADDTOTITLE style in your CMainFrame:PreCreateWindow(..) method .Just do this. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { cs.style&=~FWS_ADDTOTITLE; //The last line was added to remove 'Untitled' from the //Title of Main Window return CFrameWnd::PreCreateWindow(cs); } ------------------------------------------------------------------- Anujit Sarkar(e-mail address:anujit@vedika.ernet.in) ------------------------------------------------------------------- Resi: 102 Southern Avenue Office:Vedika International 'Sarobar' 7 N.E. 21 Lansdowne Court Calcutta -700029 5B Sarat Bose Road INDIA Calcutta-700020 INDIA Phone No.+91-33-4661473 Phone No.+91-33-2473810 ------------------------------------------------------------------- -----From: Wolfgang LochNormally (In VC1.5 or VC2.0) the title line should be "MyApp - [Untitled1]". When you bring up the File-Save dialog the default filename will be "Untitled.ext". You can change the default title and extension in the string table entry IDR_MYDOCUMENTTYPE i.e. to "MyDefaultTitle" and extension "xyz". Then the title bar will be "MyApp - [MyDefaultTitle1]". Then at File-Save the filename will be "MyDefaul.xyz" (8.3 format for 16bit app). I guess there is not a simple way to get rid of the "1" in title bar. cheers Wolfgang -- /-------------------------------------------------\ | Wolgang Loch (Technical University of Ilmenau) | | e-mail: Wolfgang.Loch@rz.TU-Ilmenenau.DE | | www : http://www.rz.tu-ilmenau.de/~wolo | \-------------------------------------------------/
Manos D. Anastasiadis -- manos@ced.tuc.gr Friday, August 02, 1996 There's a quite simple solution: override the implementation of CFrameWnd::OnUpdateFrameTitle() and do whatever you want with your frame's title (like building a string and calling SetWindowText) I think it's undocumented, so take care - it works for me anyway /*==================================* * Manos D. Anastasiadis * * Computer Engineering Dept. * * Technical University of Crete * * Mu.S.I.C. * * manos@ced.tuc.gr * * Chania-Salonica-Kwnstantinoypolh * *==================================*/
| Вернуться в корень Архива |