Changing the DefaultFileName before rvActionNew

General TRichView support forum. Please post your questions here
Post Reply
nachbar
Posts: 11
Joined: Sun Dec 12, 2010 11:35 pm
Contact:

Changing the DefaultFileName before rvActionNew

Post by nachbar »

I would like to programmatically create a new file, and provide a default file name and directory to be proposed when the user saves the file. I can do that by changing the DefaultFileName in the ControlPanel at design time, but if I try to change it before executing the New action, my change is not used.

For example:

Code: Select all

	srvActionsResource->rvActionSaveAs1->InitialDir = "Z:\\work\\2011\\TRichViewTests\\FileStorage";
	RtfEditorForm->RVAControlPanel1->DefaultFileName = "funky.rtf";
	srvActionsResource->rvActionNew1->ExecuteTarget(RtfEditorForm->GetActiveEditor()->RichViewEdit);
	RtfEditorForm->ShowModal();
A better solution might be to execute the rvActionNew and then change the temporary file name just for that new document without changing the DefaultFileName for additional new documents created by the user. Can you advise the best way to do that?

For reference, I am working with the ActionTestTabsCB2010 demo with ScaleRichView.

Thanks!
Sergey Tkachenko
Site Admin
Posts: 17525
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I tried to reproduce this problem, I used a Delphi version of ActionTestTab demo.
I added a button with code:

Code: Select all

   srvActionsResource.rvActionSaveAs1.InitialDir := 'c:\windows\';
   RVAControlPanel1.DefaultFileName := 'funky.rvf';
   srvActionsResource.rvActionNew1.Execute;
(this code creates a new document in a new tab; to create it in the active tab, Execute must be changed to ExecuteTarget(ActiveEditor)).

All works as expected...
Post Reply