Click to See Complete Forum and Search --> : How to open different document templates using button messages?


Hurol
September 3rd, 1999, 10:11 AM
Hello all,

Perhaps the answer to this question may be found in some FAQ somewhere,
but I could not locate a simple answer yet.

I want to create more than one document template and open a specific one if the user selects a toolbar button; I don't want the program to display the File type dialog box. I had once learned how to bypass the dialog, but never found out how to start up a certain doc type depending on a button message.

Does anyone know where I should answer the toolbar message and what steps I should take to create/open a certain doc type?

Sincerely,

Hurol Aslan

Oleg Lobach
September 6th, 1999, 03:52 AM
Hi,
Try this:

1.Add these lines to your CWinApp derived:

CMultiDocTemplate *pTemplate1;
CMultiDocTemplate *pTemplate2;
..
CMultiDocTemplate *pTemplateN;


;
2.In your InitInstance "init" these pointers:

pTemplate1=new CMultiDocTemplate(..);
pTemplate2=new CMultiDocTemplate(..);
...
pTemplateN=new CMultiDocTemplate(..);



and delete the line wit ProcessShellCommand call.
3.Create handlers for your toolbar buttons in which create empty documents:

pTemplate1->OpenDocumentFile(NULL);
...




Good luck,Oleg.