I'm trying to make a method to hide the toolbar and menu in a JFace ApplicationWindow. I tried:
getToolBarControl().setVisible(false);
getMenuBarManager().setVisible(false);
This has no effect on the menu bar. It hides the ToolBar but still leaves the space where the ToolBar was.
(I'm trying to full-screen a composite by hiding them.)
Try overriding ApplicationWindow.addMenuBar() and ApplicationWindow.addToolBar(int) with empty methods.
UPDATE
Sorry, I didn't understand, that you want to hide the controls only temporarily.
That's more complicated. ApplicationWindow overrides Window.getLayout(), and instantiates an ApplicationWindowLayout in this method. That layout does not provide an option to exclude a child temporarily.
You could override this method again and provide a GridLayout instance instead. To position you all direct children of your window, such as the toolbar, the menu, the status bar and your main content component, you need to set GridData instances on them. But if you do so, you can toggle gridData.exclude and call window.layout(), to show or hide the menu and tool bar.
Related
I am working on a text editor app that needs an inspector sidebar for special actions with the text. I am therefore using an NSSplitViewController to manage the overall layout. I want the sidebar to take advantage of macOS' new full-height sidebars. I already have an NSWindow with a fullSizeContentView style mask. And my corresponding NSSplitViewItem has the property allowsFullHeightLayout set to true.
Unfortunately, I am still getting this layout:
Additional information:
The Inspector sidebar is an NSHostingView with a SwiftUI View wrapped inside.
When using the accessibility inspector, I can see that the sidebar layout is expanded all the way up, but the NSToolbar seems to be ignoring it.
I need to keep both the title and toolbar
It is possible to let the toolbar know that there's a split view divider by using a special NSToolbarItem. By creating a custom identifier and rendering it as an NSTrackingSeparatorToolbarItem, I was able to extend the line all the way up.
To make the inspector view background extend to full height layout, I had to use window.titlebarAppearsTransparent = true.
This blogpost helped me to figure out everything: https://christiangiacomi.com/posts/setup-nstrackingseparatortoolbaritem-macos11/
I have a UITableView that displays some data that is read in at runtime and features a button below it that will refresh the list when clicked. All of that works fine, however there is a problem with the layout on the simulator.
When I run, there is a space at the bottom of the table that pushes the refresh button down. No matter how long the UITableView is, the UIButton will always be kept at that extended distance. If I overlay the bottom with the UIButton, it does display with slightly less padding. I am at a loss of how to fix this.
Image with example of behaviour: http://img864.imageshack.us/img864/9913/screenshot20120326at113.png
I think the problem is that in the interface builder your layout does not show at the same size, because it lacks the navigation bar at the top.
In the visual editor, choose the window hosting your table view, go to the attribute inspector, and choose Navigation bar for the Top Bar entry in the Simulated Metrics section of the inspector. The layout of your design will change. Resize your table view, move your button, rebuild the app, and run it again; this should do the trick.
It looks like it's because you're designing without the navigation bar simulated and you've set up your autoresizing masks incorrectly.
What you can do is either enable the simulated metric (attributes inspector in IB with the main view selected) for the top bar set to Navigation Bar, or you can go and fix your autoresizing masks. They are the red things in the size inspector in IB.
It is because when you designed the screen you didn't consider the navigation bar that is gonna come. Simply add a bar to the screen on the top and rearrange the table and button with proper autoresizing masks. It will fit.
I would like to add a toolbar with a label entitled "Save your search?" on the left and a button "Save" on the right that triggers a specific action when tapped. How could I do that programmatically, especially I want this Toolbar to show up only when a particular View is loaded on a screen but not on every view.
Also, I want the toolbar to have a static image as background. "Save" button will also have a static image for background
Just to check; why do you need to add this toolbar of sorts onto a TableView? Depending on how you've set things up; and specially seeing that you need to conditionally hide/show this toolbar, might be easier to add it outside the tableView (just above it I guess).
Seeing as you need to hide/show this toolbar at will; guess you can simply use a UIView for it and add the UIButtons on top as subviews; --> declare it as a property in the .h file so that it can be freely accessed in the .m file whenever you need to hide / show it.
Did you need help on some specific issue related to this perhaps; or would this serve as a goo enough starting point?
I want to change my common toolbar style to this style..
Transparent toolbar.
the round conner at the left and right side.
press any of them have the click events. (all of them have already implemented in the old toolbar version.)
Your best bet is to just write your own custom view. You can use an image for the background and then use a set of uibuttons and customize to your hearts content. It'll be easier than customizing the toolbar.
I have a main view that has has two buttons on it that control methods to display the next image and display the previous image. In this case the 'Image' is a class that inherits from UIImageView and has multiple pictures on it that you can interact with, and I call this class a 'Pane'. The pane itself handles all the user interaction itself while the main view controls the display of next and previous panes with the buttons. Here is my dilemma, because the pane fully covers the main view it wont allow for the user to tap the buttons on the main view! So once a pane pops up you cannot change it via the buttons! Is there a way to allow touches through transparent parts of a view, or if not how in the world do I achieve this?!
I cannot pass touchesBegan or any of those methods from the pane to the superview because all of the button touch methods are created in the xib file.
I cannot insert the pane under the control panel because then you wouldn't be able to interact with the pane. And as far as I know theres no way to pass touch events to every single pane within the paneHoldingArray that belongs to the main view
I cannot add the command buttons inside of the pane because I want to be able to replace the command button's image with a thumbprint render of the next/previous pane.
I've been stuck on this for a very long time, please somebody help me out with a fix action or a new way to re-engineer the code so that it will work!
If you want the buttons to capture events, then layer them above the pane. You say you cannot put the control panel above the pane, so break the buttons out into another view that you can put above the pane. If you want the buttons to appear under other views, then make some completely transparent custom buttons to handle you actions that you can layer on top.
I don't know what you mean by the button touch methods are created in the xib file, but in general you cannot effectively pass touch events around. You must organize the view hierarchy so that the views you want to receive events are logically on top. However, nothing says that the views on top have to be opaque or even visible.