Page 1 of 1

Changing the DefaultFileName before rvActionNew

Posted: Tue Jan 04, 2011 4:07 pm
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!

Posted: Tue Jan 11, 2011 8:33 pm
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...