Save Dialog Native calls through C++?

I have searched through many forums but I havent been able to find the right solution for my problem. Let me describe the issue. I have been trying to port an application from Windows environment to Mac and so far there has been no issue except for selecting a folder to save files. The save dialog has been coded specific to the environment. So in windows we have a Windows specific call through C++. I have gone through Carbon/Cocoa API but havent figured out how to call it through C++. Can you please help me out figure the right way to call the Save Dialog APIs in Mac to get a folderpath?

Hi CDA, and welcome to the Dev Forums!
I didn't catch whether you're trying to build a Carbon app or a Cocoa app. A MFC programmer might feel more comfortable with Carbon, but as you may know, Cocoa is recommended for new OS X apps.
In any case, I think NSSavePanel is pretty much the standard now. Have you looked over Using a Save Panel in Application File Management?
Re a C++ interface to Cocoa, it can be well defined or invisible depending on your requirements. Xcode allows you to freely mix C++ and Obj-C in the same file. So you don't need to segregate the code unless you want to. For example, if you wished to have all your C++ code in .cpp files and all your Obj-C code in .m files, you could wrap all the code needed by NSSavePanel into a C function, then call that function from C++. But if you didn't mind commingling the code in a .mm file, you could create and use a NSSavePanel object directly from the methods of a C++ class.
The above example may be oversimplified because if you want to use NSSavePanel, you might want to use NSWindow as well. But the mechanics of bridging C++ and Obj-C will still be the same. Take a look at Using Cocoa Functionality in a Carbon Application for more details.
Hope that helps!
\- Ray

Similar Messages

  • Call Save Dialog [Save As] is not allowing me to Bookmark in Portal

    Hi All,
    I am facing some problems trying to implement BEx bookmarking into my Portal. To explain a little further about our setup, we have a master web template which is connected to approximately 80+ queries. Within that web template, we have a button which has the CALL SAVE Dialog Save_As which should, in theory, allow users to bookmark their queries via the Portal.
    Unfortunately, this is not working and when a user attempts to bookmark a query and save it via the Portal, the following blank screen is displayed with this URL: http://PORT NUMBER/irj/portalapps/com.sap.portal.navigation.helperservice/html/child.html.
    If anyone could offer any insight into this issue I'd be truly grateful - THANKS!
    Bim

    Hi,
    There might be a technical Rollup
    When you restart the Application Host Helper Service on Windows Server 2008, it might help.
    Or, if not, why don't you try to take an backup of the existing queries & perform a backup. I'm sure the error can be resolved.
    Thanks,
    Arun Bala G

  • How to download files in jsp code {through save dialog}

    can you help me to download files in jsp code {through save dialog}
    i use the following code but it saves the jsp page instead of the downloaded file but with the name of the wanted file to be downloaded
    response.setHeader("Pragma", "public");
    response.setHeader("Cache-Control", "no-cache");
    *** download file
    if((trans !=null)&&(trans.equals("download")) )
    response.setContentType ("application/x-download");
    response.setHeader ("Content-Disposition","attachment;filename=\""+fileName+"\"");
    %>
    <script>
    window.location.href=<%=gallerypath+fileName%>';
    </script>
    <%
    trans="";
    //System.out.print("download : "+fileName );
    //***************************************

    Can you try below code, It should work...
    <%
    String myFileName = request.getParameter("fileName");
    response.setContentType("application/octet-stream");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + myFileName + "\"");
    String root = "D:/";
    InputStream in = null;
    ServletOutputStream outs = response.getOutputStream();
    try {
    in = new BufferedInputStream
    (new FileInputStream(root + myFileName));
    int ch;
    while ((ch = in.read()) != -1) {
    outs.print((char) ch);
    finally {
    if (in != null) in.close(); // very important
    outs.flush();
    outs.close();
    in.close();
    %>

  • Check if file downloaded successfully , through Open Save dialog box

    hi,
    In the jsp I have a download link through which user can download a file which is located on the server . I have achieved this by setting the response type in servlet as follows => response.setHeader("Content-Disposition", "attachment; filename=" + fileName); .When the jsp page loads the user is shown a Open Save dialog box for downloading the file. The user can download the file or cancel the operation.
    But now I need to track if the user has downloaded the file successfully on his m/c , depending on which a flag will be updated in the database . I am not able to track this event . Pls help how I can check if the file has been downloaded successfully and do further processing.

    This is fully dependent on the client side. You can never rely on that.
    In most cases you could check if any byte of the file is written to the outputstream and/or no IOException is been thrown, but some webbrowsers (such as Firefox) will download the file immediately while the client still need to choose 'save' or 'cancel'. Only when the client chooses 'cancel' the download will be aborted and the file will be deleted. But if the file is small and/or the network is fast, then the file download might be already completed at that time.
    Again, you can never rely on what happens at the client side.

  • Open/Save Dialog, 9 min. Beachball Freeze

    I am running OS 10.10.2 on a March 2009 iMac with 8GB RAM and 1TB HD.
    PROBLEM: While working in Illustrator 18 (CC 2014), if I choose File > Open, the Open dialog appears but I get the spinning beachball for 9 minutes before file contents appear. I don't have the same problem in Photoshop or any other app.  But after Googling, I see that a number of people have posted similar Console Log messages (see below) when using in a variety of apps in Yosemite, even in Apple's own Mail app.  This tells me the root problem may not be specific to Illustrator, even though it only affects Illustrator in my case currently.
    WHAT I TRIED:
    1) Moved all Adobe Illustrator related PLISTS and preference files and folders to the Desktop and then launched Illustrator.  I saw Illustrator rebuild new prefs files and all settings reverted back to stock.  This proves my moving of the prefs to the Desktop was successful to cause a rebuild of new prefs and PLISTS. Even so, the BeachBall freeze appeared when I did a File > Open.
    2) Rebooted with SHIFT held down (Safe Mode).  But the beachball problem remains.
    3) Disconnected all USB devices except keyboard/mouse, and turned off WiFi and BlueTooth, and even yanked my Ethernet cable.  I also turned off Time Machine and Default Folder.  But the problem remains, even through a reboot.
    4) I removed DropBox and GoogleDrive and I closed all apps other than Illustrator, but to no avail.
    5) Tried a Guest User, but that doesn't work with Adobe Apps.  Ditto for a Standard user.  You get an error dialog when you try to launch Adobe apps with that kind of user.  So I then created an Admin user.  Illustrator's Open dialog box displays files perfectly, as normal!  A NEW ADMIN USER FIXES THE PROBLEM!
    So a new Admin user fixes the beachball problem in the Open dialog, but for my normal Admin user there's the 9 min. beachball problem.  And yet, SAFE MODE doesn't fix the problem while in my normal User.  And neither does deleting Illustrator prefs.  So it's clear there's still something lurking in my primary user account that is absent in the new Admin user account.  But what?  And how can I find it?  (Migrating everything to a new User account is no easy task.)
    Pertinent section of CONSOLE system.log:
    Mar  6 13:27:03 iMac.local WindowServer[151]: disable_update_likely_unbalanced: UI updates still disabled by application "Adobe Illustrator CC 2014" after 15.00 seconds (server forcibly re-enabled them after 1.00 seconds). Likely an unbalanced disableUpdate call.
    Mar  6 13:27:19 iMac.local NetAuthSysAgent[858]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    Mar  6 13:27:19 iMac.local NetAuthSysAgent[858]: ERROR: AFP_GetServerInfo - connect failed 64
    Mar  6 13:27:49 iMac.local NetAuthSysAgent[858]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    Mar  6 13:27:49 iMac.local NetAuthSysAgent[858]: ERROR: AFP_GetServerInfo - connect failed 64
    Mar  6 13:28:19 iMac.local NetAuthSysAgent[858]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    Mar  6 13:28:19 iMac.local NetAuthSysAgent[858]: ERROR: AFP_GetServerInfo - connect failed 64
    Mar  6 13:28:24 iMac.local com.apple.SecurityServer[56]: Session 100025 created
    Mar  6 13:28:49 iMac.local NetAuthSysAgent[858]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    Mar  6 13:28:49 iMac.local NetAuthSysAgent[858]: ERROR: AFP_GetServerInfo - connect failed 64
    Mar  6 13:29:19 iMac.local NetAuthSysAgent[858]: DNSAddressResolver:Resolve CFNetServiceResolveWithTimeout failed
    Mar  6 13:29:19 iMac.local NetAuthSysAgent[858]: ERROR: AFP_GetServerInfo - connect failed 64
    the above repeats while time elapses (I deleted this part for brevity)
    Mar  6 13:35:40 iMac.local mds[33]: (Volume.Normal:2464) volume:0x7f9823863800 ********** Bootstrapped Creating a default store:1 SpotLoc:(null) SpotVerLoc:(null) occlude:0 /Volumes/WORK_SPACE
    Mar  6 13:35:42 iMac com.apple.xpc.launchd[1] (com.apple.TMHelperAgent.SetupOffer): Service only ran for 2 seconds. Pushing respawn out by 8 seconds.
    Mar  6 13:35:42 iMac.local mds[33]: (Volume.Normal:2464) volume:0x7f9824087000 ********** Bootstrapped Creating a default store:1 SpotLoc:(null) SpotVerLoc:(null) occlude:0 /Volumes/GLOBAL_SPACE
    Mar  6 13:35:43 iMac.local WindowServer[151]: common_reenable_update: UI updates were finally reenabled by application "Adobe Illustrator CC 2014" after 534.23 seconds (server forcibly re-enabled them after 1.00 seconds)
    I get the exact same set of messages that you see above every time I try to reproduce the problem, simply by doing a File > Open in Illustrator.
    I assume AFP is Apple File Protocol?  But what "server" is it trying so desperately in vain to "Get"?  And why is a DNS resolver being used?
    Anyway, as you can see from the Console log above, the beachball in the Open/Save dialog in Illustrator goes away after 534 seconds (about 9 min.).  But it reappears each time I try to go to a new folder on my HD within that Open dialog.  Each time takes exactly 534 seconds each time for the stupid beachball to go away when changing folders in the Open dialog. 
    This beachball freeze (for 9 min.) in Illustrator's Open dialog occurred every once and a while over the last several weeks, but now it consistently happens.  And no, I've not installed any new software on my iMac other than Yosemite updates.
    Once again, I would prefer to fix the root problem in my primary user account rather than migrate to a New User even though I now know a new Admin user account resolves the problem.
    Please help.

    With regard to my cry for help...
    Pretty please?
    Here are links to other apps which show the same Console Log messages that I am seeing, proving this is not an issue exclusive to a single app:
    Vmware & OS 10.10.2
    Pertaining to networked HD's
    Shared Mac on a Network
    Prevents Time Capsule access and kills Time Machine too
    OS 10.10 & Time Capsule woes
    OS 10.9.2 & NAS woes
    Yosemite & Time Capsule woes
    iPhoto woes after Migration
    More Time Capsule woes
    Time Machine woes from Germany (translated)
    mDNSResponder stuck in restart loop
    If you read through all the above like I did, you're probably very tired by now.  But if you had the same problem as I do, you would do anything to resolve it, hence my post here.  So again, I plead for your kind help and attention to this problem!
    The above links do tell me one thing, that a "network error" is at the heart of the Console log messages and my problem.  And that remains true even when I've disconnected from the network entirely, leading me to believe that this is some sort of CACHING BUG.  For truly, there is a Time Capsule at my office, and I do use Time Machine (although not saving to the TC but instead to an external FW HD).  So...  It is my guess that Yosemite has cached some network data it doesn't like and tries to access that data from a cache when the Open Dialog appears in Illustrator.  But WHY ILLUSTRATOR in my case?  It makes no sense to me at all.  I would think it should consistently occur in the Open dialogs of all apps, but it's only in Illustrator.
    I did have problems with my Time Machine backups after putting Yosemite on my iMac, but those issues were resolved in the 10.10.2 update.
    In any case, if indeed it is a CACHING BUG, how then would I clear that stupid, evil cache?
    Again, I would appreciate your kind thoughts and advice.
    Thank you!

  • How to make save dialog open up folder where document originates as default

    Hello
    I was wondering if there is a way to make save dialog open up the folder where document originates as default. I feel Like I am wasting a lot of unnecessary time navigating through menus saving certain documents.
    Example : I open an Excel document in a folder called 2009. I make some changes and then do a "save as" -- I want it to automatically bring me first to the folder where I opened it, not the last place where I saved to.
    I recall being able to set this preference in macs a looong time ago. Now I can't seem to find it. Thank for your help

    Rick,
    Sorry about the misgiving adresses, folders and access rights. My question is not about these three (they were just here to tell the story). You're perfectly right to say that in a local network, there's not need to complete the full IP or ".com" name of the PCs (even if it works all the same).
    When I said "of course" for the perms, it was just to mean, in the same way, that it's not this kind of problems here.
    My question is much more a human/mac graphic interface problem than a network problem. I want the people (as well as myself) to be able to go in a folder on the pc network with a simple click on an smb link in an email message (as they do now on an ftp or afp link).
    Thanks for the bother,

  • How to maintain reference across native calls?

    I'm using JNI to interface with an underlying C++ communications library. I am having trouble keeping my connection valid across native calls.
    For example, in one method I connect and save the connection in a global variable, then return. After I connect I would like to call a "send message" method, but when I do I doesn't recognize the saved connection.
    My question is do saved references persist across JNI calls when using the same object, or will all global vars be new ones? If not, does anyone know a way to get around this?
    Thanks for your help

    All JNI references that you create (through calls to NewObject, GetObjectArrayElement, GetObjectField, ...) or that are passed to your native code as parameters are local. That means that they are only valid for the duration of that native call and only on the thread from which that native call was invoked.
    You can create global references from local references using NewGlobalRef. A global reference is valid across all threads and does not have a limited lifetime. You must make sure to release your global references once you are done using them by calling DeleteGlobalRef.
    God bless,
    -Toby Reyelts
    Check out Jace, http://jace.reyelts.com/jace

  • Open and Save dialog boxes are sorted reverse alpahbetically by default

    I have a user that experiences the same frustrating experience every time she restarts Apple Mail. All of her open and save dialog boxes in Mail are sorted from Z to A. She can click the name field to change the sort, but it will return to Z-A if she quits and reopens the program. The Finder is set (and stays) at A-Z. Other applications do not exhibit this problem. I am loathe to reset the preferences since that means having to set up accounts again. Restarting the computer and removing user caches made no difference. Any suggestions?  This is an iMac Mid 2008 running Mac OS X 10.6.8.

    I solved my own question through trial and error.
    Just select "None" on the dropdown selector (see screen capture, above) and the Open/Save dialog will revert to the older version.

  • Open and Save Dialogs Slow to Open and Populate

    In all of my apps, the Open and Save dialogs have become very slow to open and populate since installing Snow Leopard, when the machine is connected to a Windows server. Disconnecting from the server solves the problem; reconnecting causes it to reappear.
    This only happens on some of my machines, and not others
    Any thoughts on what this could be. The delay is significant (about 10 seconds in all).

    Roy,
    I've got the same problem. I've been charting the slowness, i.e. the time until the app responds and opens the save dialog box, and most apps hover around 2 minutes of waiting.
    My home network consists of a belkin n+ router (running only with the N radio, and WPA2 security), one ethernet-connected powerbook with a USB-connected hard disk (640GB+), and my MBP connecting by wireless. The USB HD is used as a Time Machine backup disk, and the backups are extremely slow, on the order of 2 GB's per hour at most.
    That said, I called up Apple Tech Support and they had me flash my PRAM, restart the machine, and Reset Safari (since that was the app I called about). These efforts, unfortunately, did not fix the issue.
    I will be passing on the fact that Tech Support's efforts did not solve the problem--maybe they'll get back to me on the issue. If so, I'll post it here.

  • Open/Save Dialog Box SLOW

    My Mac has slowed down to an absolute crawl. I have reinstalled the OS, run Disk Warrior, Disk Utility, removed my preferences folder to see if something in there was actin' up, I've repaired the permissions, etc... Yet in any application (whether it's Photoshop CS 2, Safari, TextEdit, doesn't matter), if I hit "open" from within that application... no exaggeration... it can take anywhere between 45 seconds to a little over a minute for the dialog box to finally appear!
    The last thing I want to do is nuke my machine. I am so tired of that being the solution whenever something can't be fixed.
    Has anyone run into this? Does anyone have any ideas what to do to fix this problem without nuking the machine?
    (this hasn't been a problem at all until, maybe 3 months ago or so... and I've been running Tiger since it was released)

    Holy cow. I am in complete shock.
    ...got up this morning, saw the suggestion 'bout the iDisk, figured I'd give it a try...
    That was it!!! I've had a .mac account for years, have had my iDisk on my desktop for as long as I can remember. I wonder if something from software update somehow made my machine and the iDisk go "screwy" 'cause it started getting excruciatingly bad just a few months ago.
    Thank you, thank you!! My machine has received a gigantic speed boost across the board, and the open/save dialog boxes now appear instantly when I call upon them, all my apps quit instantly now too. This is amazing! [breathes huge sigh of relief]

  • Find in Open/Save Dialog boxes

    The find in open/save dialog boxes seems to return unexpected results. Say I have two folders one called "Down under" and the other called "Down under 2". If I ask it to find "down" it only returns the file "Down under 2" and other files whose content may have the word "down" in them. The folder "Down under 2" only has jpegs in it. None have "Down" in the file name.
    So what gives?

    Surely someone knows what is going on in spotlight. If I use Easyfind for the search it comes up with both files folders correctly.

  • CS5 slow to get the 'open' and 'save' dialog box over networked computer.

    I have been having this problem since the suite was installed, but recently has gotten much slower. Any time I click open or save it takes 8-10 seconds just for the dialog box to come up.  CS1 was lightening fast - I know that was ages ago, but I can't help compare the two.  I have the same problem with InDesign and Illustrator. The suite is running on a Windows 7 machine through a home network, accessing files from an XP machine as well as a Buffalo Linkstation.  Once the dialog box comes up, and I double click, the file is pretty quick to appear.  I have researched online and I believe the problem to be somewhere in the network or the settings.  The network is quick, Windows Explorer has no delay in opening or finding files, nor do other programs outside of Creative Suite. I did an experiment to narrow down the problem - I closed Photoshop, unplugged the network cable, and reopened the program.  AMAZING - it was SO FAST to open the dialog box for both opening and saving files!  I then closed Photoshop again, plugged the network cable back in, and opened Photoshop.  It was back to the slow opening of the dialog box.  Everything else in the programs runs fine - no delay when performing operations in any of the Creative Suite - it has to do with the network and how CS is looking for the files.  Can anyone help me, I am so frustrated - this is adding unnecessary time to everything I do and I dread opening and saving any files!!

    Once again - thank you!
    We used to have a network storage device attached to our home network, but it crashed and we replaced it with another model.  A while back I had added it as an item to display in the places bar.  When we removed it from the network, the link on the left side disapeared, so I forgot all about it.  When I read your posting it jogged my memory.  I searched the subject to remember how I had made the change and found this posting from Adobe Community: http://forums.adobe.com/thread/795196 (its in #6).  I found the original storage device in the places bar, removed it and replaced it with the new device.  I opened Photoshop and Acrobat and both open and save dialog boxes appear as they should - the problem has been resolved!  THANK YOU!

  • Open and save dialog boxes just show earlier and can't be sorted

    Mountail Lion has new open and save dialog boxes that are displayed in groupings by date and other variables.
    My Photoshop CS5 shows "Previous 7 days", "Earlier", etc. I can no longer adjust this sorting. Often, just the "Earlier" shows and current files are missing from the box. I used the sorting option but can't sort within the list.
    My inDesign files still use the earlier open and save dialog box. Where can I switch between these options?
    Photoshop Open:
    inDesign Open:

    I solved my own question through trial and error.
    Just select "None" on the dropdown selector (see screen capture, above) and the Open/Save dialog will revert to the older version.

  • Strange SaveAs dialog in Leopard Mail 3.6

    This is the craziest thing, I've never seen this before.
    Normally when I save a message or attachment in Mail, the Save As dialog rolls down and when I look at it in list view, I see two columns headings, Name and Date Modified.
    Starting this morning, when I try to save a message or an attachment, the column headings BOTH say Date Modified. What's going on? How can I fix this?
    Icon view and column view seem to be the same... but I like using list view. Or at least I did, when it worked. This seems to only happen in Mail -- my Finder is unchanged and the Save As dialog is unchanged in every other program I've checked (CS4, word.. I even dusted off iCal).
    Anyone?

    Yes, I've looked all through the user forums and cannot find any similar complaint anywhere -- as far as I can tell, this has never happened before!!
    I've tried restarting OSX, rebuilding the mailbox. Can someone give me some other basic troubleshooting that might have any effect on the SaveAs dialog?

  • Acrobat PDF Printer STILL freezes when pasting filename into Save dialog

    Ref: Acrobat Printer Freezes on Save when CTL+V is used
    No change in Acrobat X.  Printing system still freezes up entirely when pasting a filename into the Save dialog, when printing to Adobe PDF printer.  Most often from Firefix (all versions through 28.0) but from other programs as well (also happens from MS Outlook 2010 32 bit).
    Any chance of an update from Adobe?
    Acrobat Pro X on Win 7 64 bit.  Multiple systems exhibit same behavior.
    Same issue occurs in Acrobat XI Standard.
    Workaround is possible by manually typing in filename, or renaming, but clearly this should not be happening.  If you forget, it requires a lot of steps (or a reboot) to try again.

    If you copy text directly from FireFox (or Word, or pretty much any program, other than Notepad), and try to paste into the Save Dialog to save your PDF, guaranteed crash.
    HOWEVER, if you paste the text into Notepad first, and then copy it again, you can then paste into the Save dialog no problem.  This is why the "test" that the Adobe rep did to recreate the problem was pointless: He managed to re-create the one workaround method that DOES work, instead of actually trying to do things the way that were causing the issue to show up.
    The problem appears to be related to any sort of "rich" text.  Windows ignores the "rich" information and only keeps the text if you paste into a filename in the system.  So Windows handles it just fine, it's Adobe's save dialog that can't handle it.  Copied text from Firefox is usually pretty clean (IE is worse), but there must be some formatting remnants in there that are giving Adobe fits (instead of properly ignoring them).  It may have something to do with 64-bit Windows and 32-bit Firefox and 64-bit Acrobat all coming together?  Copying and pasting between 64-bit and 32-bit programs usually has no issues, but in this case, it does (although the 64/32 bit relation is pure speculation on my end).
    But by "washing" your text through Notepad first, it completely strips it down to truly pure plain text, which can then be pasted into Adobe's Save dialog without a crash.  This adds an extra step, and should be entirely unnecessary, but it does work.  At least until Adobe fixes their program.

Maybe you are looking for

  • Some issues in test db

    Hello experts os: sun solaris db: 10 g R2 I found some problems in my test database I have tried to 1) create 1 tablespace with size 1 gb of datafile with autoextend clause... the query went into halt to very long time , so i have cancel the statemen

  • How to get line number in JAVA code?

    Hi, What method can I use to return the current line number of my coding? Assuming I'm at line 10 and I want to do something like System.out.println("I am at line number " + ????);What method should I use to get "10"? Please advise. Thank you.

  • Attached libraries

    Hi, I have changed a function inside library, it had 3 parameters changed to 4 parameters. I complied it and saved also generated the .plx. Now the question is do I have to re-attach the library to the forms or it suppose to pick it up. I know it has

  • Possible solution for spinning beachball in 8.1 update

    After installing the 8.1 update, iTunes would simply freeze unless I either already had an active internet connection before launching iTunes or started one while iTunes was "not responding" - the beachball would disappear and it would suddenly work.

  • I am trying to use the hourglass pointer to tell the user to wait, but it won't actually disappear until the user moves

    the mouse, even if the code that originally loaded the hourglass has finished running. Is there another call to change it back?