Features and Events in FileChooserWidget GTK# - mono

I'm using GTK#(Newbie) on Xamarin Studio Community version 6.3, on Windows.
Recently, I was trying to build a Total Commander application. During the construction, I used the File Chooser Widget and found some issue that I can't solve:
1- When I click on a folder in Places box, a few buttons will appear: \ <icon button with a pen and a paper> enter image description here. When I click on the Icon Button, a Location Entry will show up. However, I don't know how to use that entry like opening a folder, folder path will show up on Location entry or enter folder path, folder will open on the widget. My temporary solution is create a entry:
FileChooserWidget fcw1 = new global::Gtk.FileChooserWidget(((global::Gtk.FileChooserAction)(0)));
Entry e1 = new Entry();
e1.Text = fcw1.CurrentFolder;
I hope to find the way to capture that Location Entry and use it.
2- On the workplace I have a problem in open a file by using Double-Click Event. My code:
[GLib.ConnectBefore]
protected void OnFcw1ButtonPressEvent(object o, ButtonPressEventArgs args)
{
if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.TwoButtonPress)
{
entry1.Text = fcw1.Filename;
if (File.Exists(fcw1.Filename))
Process.Start(fcw1.Filename);
}
}
3- The same problem of find The use of the Search and Recently Used that Could not start the search process
The program was not able to create a connection to the indexer daemon. Please make sure it is running.
Please help me find the solution and teach me how to find the name of all these widgets. Thank you very much!

To answer #1 there's a Action property on the FileChooser widget which will allow you to set it up for what you want it to do (Open, Create, Select Folder etc). The Location field contains the filename (that you select if browsing, or can type in if creating a new file).
On #2, default behaviour for double-clicks on FCW is to drill-through on folders and select for files. Because you've got a Glib.ConnectBefore attribute your event handler will run before the default handler. Maybe whatever problem you have in #2 is related to the handlers?
On #3 sounds like an issue on your dev machine. The FCW will allow you to search the file system so long as it can connect to the daemon so it looks like that's not running. I've not had an issue with that in Windows, Mac OSX, Ubuntu or RHEL on other machines.

Related

How do I open a file with a specific application rather than its default application?

I am trying to open files using a specified executable; just like as if you were to right mouse click on a file then scroll to "Open with"
I tried what kaymaf said and reviewed the docs, but I cannot seem to get this to work.
Dim FI As New FileInfo(GetFileNameFromListViewItem(ListViewCollection.SelectedItems(0)))
Dim GetExif As Process = System.Diagnostics.Process.Start("C:\Users\*username*\Downloads\exiftool.exe", FI.FullName)
This just ends up open the executable and rather than opening the file with the executable.
You would like to open a file with your program using the Windows context menu; and do you want to get an entry in that menu? If that is not correct, the answer can be deleted.
I found this in a German forum, and they refer to this site:
This is the translated text:
One possibility would be that you register your file extension and your program in the system to open this file extension. As soon as the system knows everything, you only need to right-click on the file(s) and in the context menu, in addition to the standard entries, another menu item for opening these files is displayed. If you select this menu item, your program will start automatically if it has not yet started, and you can read out / determine the path to this file or several files in your program and process it accordingly. How it all works is described here: ookii.org/Blog/opening_files_via_idroptarget_in_net
On this page there is also a sample for download (start text files with your own program via an additional entry in the context menu / display paths to the files). It is not a VB, but it should be translatable without any problems. Corresponding information on the page and the comments should be observed.

VB.Net Picture Box Control

OK so currently this is the code I have below of a picture box
PxBx.Image = Image.FromFile("C:\Users\Ashleysaurus\Documents\Visual Studio 2015\Projects\ThisProject\ThisProject\Images\filename.JPG")
What is the correct syntax for using images files stored in the application files after i publish a project? Namely b/c this path will not always be the same based off when/where users would store the app files?
I did a bit of searching but havent figured out how to ask the correct question to get the answer from forums/google.
Thanks in advance
I suggest you to add to your Settings.settings a new entry for the path to the folder where you store the images. This setting will be read at runtime and used to find your images. The advantage of this approach is that you can manually (or through your setup code) change the config file (where the setting is stored) to whatever your customer requires. Instead, hard coding a path (relative or not) inside the code is just a problem waiting to happen.
To add an entry in your setting.settings file right click your project and select properties, then the settings tab. Here, add a Name like "ImagePath", of Type = String and Scope = "Application", then set your current path as value and save.
Now, if you open the app.config (or web.config) file you will see the new entry and its value. To use it at runtime
string imagePath = Properties.Settings.Default.ImagePath;
You can utilize the Application.StartupPath property and use Path.Combine() to construct a proper path:
PxBx.Image = Image.FromFile(Path.Combine(Application.StartupPath, "Images", "filename.JPG"))
You have to add the image to the project.
You have 2 ways:
Create a folder in your solution explorer called Images or whatever you want. Right click on it and click 'Add Existing Item'. Choose the image you want.
Then type in your code:
PxBx.Image = Image.FromFile("Images\FileName.jpg")
Click on your project name in the solution explorer. It will take you to a new "screen" (I don't know how to call it), from the right click on 'Resources', from there you can add your image.
Then you reference it in your code using:
PxBx.Image = My.Resources.Filename

Force item icon refresh in Finder 10.8.2

Can anyone lead me to any useful link for forcing file icon refresh in new 10.8.2 version of Finder?
I'm working on this problem for last few days and I have tried almost any solution which can
be found on internet, but those are all old samples which are compatible with old versions of Finder and do not work on newer versions of Finder (which are rebuilt on Cocoa framework).
I tried to use few commands from apple script tool to update files in Finder ('update item with necessity'), I tried few plugins from internet (nudge, finder-Refresh...), I also tried support for communication with external Mac application through ScriptingBridge framework (although very useful) but nothing gave me a desired result.
I have noticed that NSWorkspace class contains two methods: iconForFile and setIcon:forFile,
and although I could integrate this two functions in application, iconForFile function is returning image of reduced quality, so I'm stuck in that direction also.
Any idea or suggestion will be highly appreciated.
If you need to update one Application icon, just touch the App.app folder.
Close the finder windows and issue the command:
touch /Applications/App.app
Create a visible file and delete it. This will refresh finder window.
To reset for every application under Mountain Lion, try the following in Terminal:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -r
That will kill all existing objects in launch services and reseed them recursively from the standard locations (/Applications, etc).
If you have a specific application whose data you need to override existing information, you can try:
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f <path>
Although I've had limited luck with the latter working in some cases, so you may end up doing the former afterwards.
Type into Terminal
killall Finder
Then
killall Dock
I had this problem too. I had a .app i wanted to change the icon of.
Structure of my .app:
...noida.app/
...noida.app/Contents/
...
...noida.app/Contents/Resources
...noida.app/Contents/Resources/myicon.icns
...noida.app/Contents/MacOS
...
...noida.app/Contents/plist.Info
Now I would change the icon in the resources folder. Then I made new files in all folders. It wouldn't work. The only place that i could make a new file tha twould update the icon was in the ...noida.app/ so i made new file at ...noida.app/junk folder and then it updated.
Very interesting.
I was just fighting with this on 10.10 (although it's been a problem for years now) and the only solution I found to force refreshing a bundles icon in the Finder was to:
Open the "Get Info Window" of the bundle you want to update and select the icon by clicking on it.
Paste another image as the icon (you could have copied this from another file or from any other location with this pasteboard data).
Press return and make sure the icon changed in the Finder.
Delete the icon by pressing the delete key.
After that the bundles icon was refreshed to the new .icns file in the bundles resource folder.

how do i change default sources folder in Netbeans 7.1.2

Does anybody know how to change the default sources folder in Netbeans 7.1.2
I've looked through the files but can't seem to locate where the default directory is stored - I have been through the forums but can't find anything useful..?
currently C:\Users\wayne\Documents\NetBeansProjects\PhpProject7
I have read that if you select a different directory then that becomes the default - this is not the case on my installation
Thanks
If you are using Windows 7 or vista, you are gonna find it here C:\Users\YourUserName\AppData\Roaming\NetBeans\7.1.2\config\Preferences\org\netbeans\modules\projectui.properties.
However if you you are using windowsXP remember the USERPROFILE enviromental variable is not Users but rather Documents and Settings. Enviromental variables change depending on the operating system you are using. To know whats the USERPROFILE variable for yours just open a command prompt window and type SET USERPROFILE. Or you can simply type %USERPROFILE%\AppData\Roaming\NetBeans\$ENTER_YOUR_NETBEANS_VERSION_NUMBER_HERE\config\Preferences\org\netbeans\modules\projectui.properties and that will send you to the correct directory.
It's actually pretty simple.
"C:\Users\wayne\.netbeans\7.1.2\config\Preferences\org\netbeans\modules there is a file called projectui"
is right on the money, but he forgot one detail that you need to keep in mind for changing the directory. If you want to set the default project folder to (in my case):
"C:\Program Files\glassfish-3.1.2.2\glassfish\domains\domain1\docroot"
then you have to double the slashes. Instead of the above link you have to put:
"C:\\Program Files\\glassfish-3.1.2.2\\glassfish\\domains\\domain1\\docroot"
without spaces. I had it that way originally but it hid one of each of them.
In newer versions, right-click on the project you want to move in the 'Projects' tab, and then click 'Move'. This will allow you to move the project to a new directory.
Tip! I found (on Windows 7) that the AppData folder is hidden, so doesn't appear in windows explorer files by default .
To make it visible, open a window for the USERPROFILE directory as above, and use
Organize ->
Folder and Search Options ->
View (tab) ->
Advanced settings list ->
Hidden files and folders radio button to show them.
(Or you can open it via search or run if you type it right)
I hope that saves you the several hours it cost me...

Opening the user's home folder?

My XULRunner application has a button named "Show Recordings". Pressing it should result in Windows Explorer opening the folder for the user. How can I achieve this?
I can't find it in the File I/O documentation, perhaps I'm looking in the wrong place.
Edit
The problem is not finding the path, but telling the system to open the folder. I can't seem to find a "openFolder" function.
You're looking for the reveal() method on nsILocalFile.
Do you mean:
%HOMEPATH%
And by that I mean, if you want a global variable to get the current user's home directory path, use %HOMEPATH%. I guess you have to set that button to this value. For a list of Windows environment variables, start at the wiki article.