Archicad C++ API
About Archicad add-on development using the C++ API.

Saving to textfile problem

Anonymous
Not applicable
Text file saving problem

Only 2 question
1. Why I have to type ./Text1.txt.txt To Get The file dialog work
2. How can I filter only text file using DG::FileDialog
	DG::FileDialog dlg (DG::FileDialog::Save);
	dlg.SetTitle ("Save File");
    dlg.SetOKButtonText ("Save");
    dlg.SetCancelButtonText ("Cancel");
	dlg.SelectFile (IO::Location ("./Text1.txt.txt"));
	dlg.Invoke();
	int count = dlg.GetSelectionCount ();
Is this a bug

I'm using API Devkit 14.2550
4 REPLIES 4
Ralph Wessel
Mentor
Paodekcal wrote:
Text file saving problem Only 2 question
1. Why I have to type ./Text1.txt.txt To Get The file dialog work
2. How can I filter only text file using DG::FileDialog
You could try using DGGetSaveFile instead.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Thanks , and I find this board

http://archicad-talk.graphisoft.com/viewtopic.php?p=116737&highlight=dggetsavefile#116737

I can find. But I don't know how to use.

Do you have any example code?

I don't know what meaning of the parameter to use.
Ralph Wessel
Mentor
Paodekcal wrote:
I can find. But I don't know how to use.
Do you have any example code?
I don't know what meaning of the parameter to use.
In the past, there was example code for this with the API. It's missing in more recent releases, but please find the original code below:
	DGTypePopupItem	popup[1] = {
		{"Text File",			"txt",		'TEXT'}
	};


	CIO::Location	loc;
	long			typeID;
	CIO::Location	defLoc("Text1.txt");
	if (!DGGetSaveFile (&loc, &typeID, 1, popup, &defLoc, "DGTest: Save File",
		DG_OF_DONT_DISPLAY_EXTENSIONS | DG_OF_NO_ROOT_GROUP))
	{
		return (false);
	}
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
I have tested your code. It can solve problem.
Thank you very much.