How can I refresh my ViewPart on maximizing? Which listener is responsible for that?
Maybe you can use a resize listener.
Add a ControlListener to the view's composite. The control listener is invoked when the view is resized or moved.
Related
I was modifying a layout in the designer, and changed the parent of an imageview from a panel to the Activity. The imageview that previously was in the panel will not respond to clicks. A breakpoint placed in the sub is never reached.
I tried both initializing and not initializing the imageview. Makes no difference.
Any ideas of why this would happen?
You should not initialize views added with the designer. Make sure that the event name property matches the sub name.
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.
This seems to me as though it would be a common problem, but I can't seem to find the answer anywhere. This question seems to address the issue, but I can't seem to get the solution to work and I'm not sure it's referring to Xcode 4.
When using Interface Builder in Xcode 4 and working with a UIScrollView, is there a way to scroll the view down in Interface Builder itself to view/add/edit controls that are out of the viewable section of the screen? I've managed to push a couple controls down using the arrow keys, but now I can't see them and therefore can't manipulate them in Interface Builder. Scrolling the view in IB would be first prize, but if there's a way to even select the controls using a drop-down menu or whatever so I can push them back up with the arrow keys, that would at least be something. Thanks.
Set the ViewController's Simulated Size to Freeform and set a very large height. E.g: 1000 and voilĂ ! You can now scroll to see all the stuff and add even more! :)
P.S: Remember to set set Fixed when you are finish to avoid problems!
Just a workaround which helps in Xcode4:
Expand the Objects Panel which resides on the left of the Interface Builder view (there is the tiny arrow at the bottom of the panel).
Drag your UIScrollView from the view hierachy and place it on the top level.
Now you can resize it to access more content (scrolling to that content did not work for me).
When you are done adding child views to the scrollview, you need to resize it back to be smaller or the same size as the parent view.
After your changes you would need to put back the scroll view where it belongs in your hierachy
I typically do the following when I want to (have to) build a long scrolling screen:
Set the size of the View Controller to Freeform
Set the height of the top level View to something very large
Arrange all the controls that I want on the View
Select all the controls
Select Editor->Embed In->Scroll View
Set the size of the View Controller back to normal (typically Inferred)
Well, there are a few different things you can do. There is a list of items in your view you can open on the left of the workspace by clicking the button that looks like a little play button on the toolbar. Double clicking any item selects it so you can use the arrow keys.
The best option is to use the layout panel (typically on the right) and enter position values manualy. Sometimes I will use this to move my scrollview up to where I can see where I'm working then move it back.
I found a solution although you have to use a Table view controller. If you define the table as static, the scroll works in interface builder when the table is bigger than the windows size. Moreover, a standard view can be added to the top and bottom of the table, these views are scrollable as well. The scroll is made once the controller is selected. I hope you find this trick useful.
I know this isn't exactly what you were looking for, but I always just drag the scroll view out of the view controller onto the "pasteboard" where you can resize it at will and see the whole thing.
Once I make my edits I simply resize it to fit it's allotted space in my view and place it back in the view controller.
set the root view to freeform and ~1000 pt height, go through the child views and set them to this height as well(including scroll view), in the viewdidload method set the height to the appropriate size.
I have a webview. I want to keep the webview in a scroll view such that it looks like entire view is scrolling. Any suggestions will be greatly welcomed...
You can simply disable the UserInteraction of WebView.Hope it works.
I have done this by extending the height of the web view, applying [clearColor] to the web view and adding drop shadows to it...
In my application i've a line for increasing the width of a widget(by dragging the line to right/left) and i've the ScrollView enabled in the same activity. I need to disable the scroll view action when the user touches the line and when user releases, it should be enabled. The ScrollView should be in visible state but the action of the scroll view should be disabled. Please help me in solving this problem. I've tried with these but none of them is working.
scroll.setEnabled(false);
scroll.setFocusable(false);
scroll.setHorizontalScrollBarEnabled(false);
scroll.setVerticalScrollBarEnabled(false);
Thanks in advance.
This might be a bit late but I ran into the same problem so my solution is similar to above, had to disable the OnTouchListener as follows:
// Get the ScrollView
final ScrollView myScroll = (ScrollView) findViewById(R.id.display_scrollview);
// Disable Scrolling by setting up an OnTouchListener to do nothing
myScroll.setOnTouchListener( new OnTouchListener(){
#Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
// Enable Scrolling by removing the OnTouchListner
tvDisplayScroll.setOnTouchListener(null);
This is a bit late, but an even easier way is to just get your parent ViewGroup and call requestDisallowInterceptTouchEvent(true) on it. This causes not only the immediate parent (scroll view) but any other parent objects that might intercept the touch to ignore it for the duration of the particular event. This is great when you have a draggable child AND draggable parent, and want to disable parent dragging while the child is being dragged.
It's also a more general solution than specifically disabling the scroll view. If you re-use your draggable child view somewhere else, it will still work: You don't need to know the scroll view's ID. Code that's re-usable without modification is always good.
If anyone's using Android L or later and overriding onTouch and onInterceptTouchEvent isn't working:
try overriding onStartNestedScroll and return false.
There is also a new XML attribute nestedScrollingEnabled, but it seems like it has to be on the View that is leaking the scroll event, rather than on the ScrollView being affected by the leak, or anywhere in the layout hierarchy between them. So if you don't know in advance what child ScrollViews you might have, overriding onStartNestedScroll for the affected ScrollView is the way to go.