I am trying to create a C# application that runs in tray where I can drop files on it's icon.
Is there any way to get the path of the file dropped on the System Tray icon? System.Windows.Forms.NotifyIcon does not have any events related to drag and drop.
it's not possible to do this, the easy way.
You can show a dummy Form, if the cursor is in a special area near the notifyicon.
The dummy Form can get the filepath of the droped file.
It has az example, but it's not fully and written in C++ :(
DragnDropOnTrayIcon
It actually is possible to do with a slightly hacky method. Fluffy App does this for its file uploader. It uses Spifftastic which uses a pretty neat little method to identify the location of the tray icon. Then a transparent window is placed over the location of the icon and used as the actual drop target, but to the end user it all appears to be dropping the file on the icon.
Related
I've written LabView code for a locking system.
The lock has a motion timer that relies on input from a numeric control. I've added a script file reader that needs to be able to change that timer value. Using a selector, I can switch between values, but I'd like it to update the value in the control, rather than override it, so that I can see it on the screen.
How can this be accomplished?
This is currently how I switch between the scripted version and the direct numeric input from the control:
So how can I get the script value to update the control box or is that not possible...?
Do you mean something like this? I created a little vi to demonstrate how the control is updated.
In most cases "property nodes" are the way to go. Every control has a lot of different options to chose from and usually if you look through the properties you will find what you're looking for :)
A little hint:
If you want to add "code" to your question so that other users can test it, you can create a .png file. To do this, you need to select the parts of the vi that you want to share, and click on "Edit > Create VI Snippet from Selection". Then you save that generated .png and upload it here as a picture. Then others can drag&drop it into their block diagram.
Important: Check the .png before uploading and make sure that you're not accidentally posting sensitive data of your company.
I am new to programming mac apps in Objective-C and need help with this. When I control click and drag to first responder from a button it brings up a box from which you can select some predefined functions that run when the button is clicked. On of the functions says newDocument. I was wondering if this means that it creates a new document (file) and if so how to actually make it create the file. I tried selecting newDocument but when I ran the app it said this: 2016-03-16 15:39:57.889 Test[26619:4382721] The (null) type doesn't map to any NSDocumentClass. My button is simply named create file and has no code attached to it, only the predefined function.
The method you are seeing, newDocument, is part of the Document Architecture. If you wish to use it you need to study the documentation, the particular function newDocument creates a "document" within your app along with an associated "window" rather than a "file" per se.
It sounds like you really need to read the Cocoa Event Handling Guide to learn how to handle a mouse event, and the File System Programming Guide to learn how to read & write files.
HTH
Can any one tell me about how to lanch a self-made application using the "openwith" feature of a mouse click event?
Your question is not very clear, but I understand it as "How do I tell the Finder that my application knows handle certain file types?". Once the Finder knows the link, it will suggest your application in the Open With submenu that appears when you ctrl/right-click on a file.
Have a look at the Apple documentation. Basically, you have to declare all the supported file types in Info.plist (or what you called it). The system is based on Universal Type Identifiers.
Is it possible to write a program for Mac OS X that monitors the trashcan and changes the icon dynamically when you fill the can?
Yes, it's possible. Candybar does it. I expect that rather than dynamically changing the icon, they just register a new 'empty' and 'full' icon with the Dock process.
Panic's Candybar lets you customize system icons (including the trash), so it must be possible.
The NSDockTile class allows you to make changes to your application's icon in the dock:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSDockTile_Class/Reference/Reference.html
The Trash is actually a hidden folder in the user's home folder called .Trash
I guess you could monitor whether or not it's empty by periodically finding the size of the folder. Or you could run ls using NSTask, and find out whether there are any files left in it.
I'd like to create a dragster/dropzone like dock menu. Looks a bit like a stack with a nsview in it.
After a lot if documentation searching and googling I've found a way to determine a dock icon's location.
(http://cocoadev.com/forums/comments.php?DiscussionID=1431)
Is nzbdrop creating a view which just looks like an stack to display it's menu or is there a better way of creating this?
Additional info:
I'm not looking for the drop like functionality just the nice way the DropBox window is displayed as an bubble/stack menu on top of it's app icon.
For anyone wanting to create something similar;
Matt Gemmell created a nice solution for this called MAAttachedWindow:
http://mattgemmell.com/source
Not exactly sure I understand your question but the Dragster and Dropzone apps clearly work something like this:
They have an application icon in the dock.
They respond to a drop request in the standard fashion.
Upon receiving a drop request, they open an application window above the dock which also accepts a drop request.
According to the link you provided, they use the accessibility API to locate their dock icon so they can open the application window above the dock icon.
The window is just a standard application window although most likely modal and floating (like a help window.) It can have any appearance you wish.