From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
11-18-2008 12:42 PM
I want to open up the file explorer when I click on a button that I created called "Save File". I want the file explorer to default to a directory of my choice. I'm not sure if there is a lab windows specific function that I can add into my SaveFile callback function. Any help appreciated. Thanks. |
11-18-2008 01:02 PM
The FileSelectPopup in the User Interface library does permit you to specify the default directory.
--Ian
11-18-2008 01:56 PM
Ok, thanks for the reply. I used the FileSelectPopUp and it worked correctly(took me to the directory I wanted) except I couldn't save the file. Here is my callback function. Could anyone tell me what I'm doing wrong. Thanks!
int CVICALLBACK SaveTblkFile(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
char pathName[MAX_PATHNAME_LEN];
string dir_append = "\\TblkFiles";
char *path = NULL;path = _getcwd(path,200);
path = strcat(path, dir_append.c_str());
switch (event){
case EVENT_COMMIT:FileSelectPopup(path,"*.txt","*.txt","Save Tblk File",VAL_SAVE_BUTTON,0,0,1,1,pathName);
break;}
return 0;}
11-18-2008 11:43 PM
Well, you are simply NOT saving the file!
FileSelectPopup opens up a windows explorer window and VAL_SAVE_BUTTON instructs the system to label the button as "Save" (and perform some check for already existing file, too), but it actually does not do anything else: saving the file is your responsibility and you can do it with ordinary file I/O commands or just a CopyFile if you already have data on disk based file name and path retrieved in pathName variable
11-20-2008 05:12 PM
06-25-2015 11:04 PM
what to do if i want to dsiplay the complete path of the selected file in a dialog box on my .uir kindly guide
06-26-2015 01:35 AM
It depends on what do you intend to do with it. "Dialog box" is a rather generic term: you can use
What is you goal?
07-14-2015 02:44 AM
thanks alot RobertoBozzolo for the answer although it was not a good question by me , well i have new issue related to it .
i have used a dialog box to display file name on which i want to save data, and a command button to use FileSelectPopUp .
well i have set a default path vale to the dialogbox specifing certian file name and if i dont specify a file it gets dafault value as complete path .
now i have an issue.
i want that if i select a specific file or specific COM port now then when i reopen the application next day or next time then the default path and default COM are the same specified by me last time so that i dont have to select everytime, i have used SetCtrlAttribute to chage the default value of Dialog Box or Menu Ring but still i am unsucessful please guide me, i will be really thankful to you.
07-14-2015 02:51 AM - edited 07-14-2015 02:52 AM
You cannot modify existing default value for controls in a UIR so that they survive a program shutdown.
What you can do is to save your desired default values in a file, reload at program start and apply them where needed.
As an alternative, you may want to consider SavePanelState and RecallPanelState commands. I personally go the first way by I point you to those commands so that you can evaluate and use them if you consider they are better for your actual needs.
BTW, I urge you to open a new thread when additional questions, like in this case, are not related to the original one. This will help other users to better locate discussion that may be of help to them
07-14-2015 02:56 AM
thanks alot Sir RobertoBozzolo i was given this advise by friend expert in .Net as well and i prefered asking you and now i will act on your advise thanks alot Sir.