I'm trying to make an OS X app, and for some reason, I can't find anything on how to add items to the Main Menu (File, Edit, etc), and how to actually handle those actions. Everything I've found is how to implement a Status Bar application, which is not what I want. Can anyone help?
The menu bar is part of your application's MainMenu.nib, and can be edited there. Like other user interface objects, each menu item has a target which can be configured to control what it does.
A video tutorial is available here. (I'm not usually a fan of videos, but this one is so perfectly on-target that I'm making an exception.)
Related
I want to add custom actions to every window's title bar context menu. The goal is to add an option like in the task view where you can move a window to a different virtual desktop. I was able to do this with hotkeys using GlobalHotKey and WindowsDesktop packages in C#. But I want to do it in the UI as well similar to some Linux desktop environments.
I know you cannot normally do this with the registry like you can with other context menus. When creating your own application I know you can use GetSystemMenu, AppendMenu, etc. and override WndProc to handle it. But this obviously will not work for what I am intending.
The application Moo0 Window Menu Plus achieves the desired effect but I have no idea how they do it.
I have a feeling the solution is probably somewhat hacky but I would still like to know how it could be done. I am open to using any language to achieve this.
You need to inject into the process, that is the only way to add a menu item.
A shell hook will notify you with HSHELL_WINDOWCREATED when a appropriate window has been created. You can then inject into the process (with another hook type or CreateRemoteThread). Once you have your .DLL in the process you can subclass the window and change the system menu.
You need to create both a 32-bit and 64-bit injection .DLL and I would recommend that you write it in native code, not C#.
I have created a JavaFX application which uses the native menu bar on the Mac via
menuBar.setUseSystemMenuBar(true);
This results in 4 standard Mac menu items in addition to the ones I have defined. My problem is that these additional items are all in english and not in german as the rest of the application. My Mac is set up for german and the Java default locale is german as well. Can anybody tell me how I can modify these default entries so that they obey the language settings of my machine?
I don't know if it is possible to set the language of the menu bar directly using Java code. But you can bundle your application and then add localization folders for every language you want to support.
For example, if your application bundle is called "test.app", simply create a folder test.app/Contents/Resources/German.lproj. Now when you start the application, the standard menu will automatically appear in german language.
You can use NSMenuFX to access the auto generate menu bar on OS X and then rename the menu items like this:
NSMenuBarAdapter adapter = new NSMenuBarAdapter();
// Get the default menu bar as JavaFX object
MenuBar menuBar = adapter.getMenuBar();
// Change the name of the first menu item
menuBar.getMenus().get(0).setText("Hello World");
// Update the menu bar
adapter.setMenuBar(menuBar);
It might not be the most elegant way to do localisation, but for me it works ;)
I'm doing an automation script for installation wizards using AutoIt. I'm trying to handle window changes in some way.
Can some one explain how these GUI's work?
When I click on the Next button it looks just like the components in the GUI is beeing changed. Is this tha case? Or is a new window created and the old destroyed?
I've noticed that the process ID is the same for all windows.
I'm sure there is some way to know which "state" the GUI is in, or which step?
By the way. All the windows has the same title.
Thanks
/Anders
This will be dependant on the program you are automating.
The easiest approach would be to look at what changes in the GUI between stages, likely candidates are if there is a label that is giving instructions for that step, or a button that has text changing (e.g. if the button says "Finish" then you know your at the end).
Most installer programs have child windows for grouping the controls of each stage. These are typically implemented as dialog resources (as can be seen when using something like reshacker on them). So although the window remains the same, the panels are being created/destroyed as appropriate. This is a very neat method of doing it, for the obvious reason that you don't need to have to code to create/destroy a lot of controls. Resource created dialogs don't have nice class names like windows sometimes do though, so this may not be a reliable way to check the state.
I'm trying to build an terminal application that, when started, will take the user away from their prompt and present them with a screen with an interactive menu. I would like the user to be able to interact with it in the following way:
They will start the application by running my_app from the terminal. This will start the application and present them with the root menu.
They will use the cursor keys to navigate around the menu and use the [ENTER] key to make a selection.
When they make a selection, they will be presented with another screen/menu when they will do some work. When they are finished this work, they will press a key that will take them back to the root menu.
The key thing I'm after is for it to not be a scrolling view that just adds more information to the end. I'd like it to have distinct, encapsulated views with a navigation hierarchy. My problem is that I don't know how to produce such a view and present it to the user, and then dismiss it again once they're done. If someone could give me some kind of design pattern for this kind of application, I'll be able to take it from there.
FWIW, I'm using Ruby and would like the app to be cross-platform. If that's too much to ask, then Windows will suffice.
I'm a Linux guy and I want to suggest ncurses library for you. there's an ongoing effort to port this also to Windows.
AFAIK it's going pretty well, please check this question.
I have created a window in gtk+ .in this window i am displaying some text and have button"next" through which i want to move to next window and my previous window should disappear.my new window should display something say,text.
Can someone tell me how to implement this?
I am new to gtk+.
It seems you want to use GtkAssistant, which is a widget precisely for the kind of interaction you are looking for. Run gtk-demo in your system to check the example with the code. It is likely you have it installed.
Also, you can check the code online in Gtk+ repository. (Check the version you want to view, either for GTK+2 or GTK+3).