ScrolledComposite splits the screen vertically and content is displayed in the right half - eclipse

I am using the ScrolledComposite for a existing control(with many children) based on the method2 mentioned here :http://www.placelab.org/toolkit/doc/javadoc/org/placelab/util/swt/SwtScrolledComposite.html
The only change is instead of creating a new shell & display I am using the existing control's parent.
I am seeing the scroll bars as expected but the existing control/content is displayed form the centre & not from the start. The first half(vertically split) of the layout is empty & the actual control/content gets displayed in the right-half.
I checked bounds, Origin, size etc. they seem to be fine.
screenshot putup here :http://img818.imageshack.us/i/contentstartsfrommiddle.jpg
Any clues
Thanks in advance

Did you delete the Composite c1? maybe that is in the left side.
You could also provide what is exactly your change to the code.

Related

How to make TextMeshPro Input Field work in layout?

I'm having odd issues trying to use Unity's Text Mesh Pro Input Field UI element. I don't actually know if the layout is causing it though.
I have a scroll view which uses a vertical layout to organize objects under the content object. Each object in the scroll view has a horizontal layout inside it which fits two input fields next to one another so essentially the Scroll view has two columns of input fields.
However I'm getting odd behavior from the input field. When I start typing it won't show the input until I've entered two characters (i.e. I type '0' and it shows nothing then I type another '0' and it will show '00'). Additionally I have some code that automatically populates the input field with default value, below is an example of how I do this:
gameObject.GetComponent<TMP_InputField>().text = numVal.ToString();
However the values never show up, but I can confirm that they are being populated by checking the inspector window while the game is running. Under the TMP_Input Field component, the 'Text' field shows the correct value but I can't see it in the input box.
I'm getting no errors or warnings.
Is it the scroll view or the layered layouts that are confusing the Input Field's script? Something else? Any advice, help, and questions are appreciated.
EDIT:
I've found that it may have something to do with the way the objects are added to the scroll view. The content of the scroll view (which has the vertical layout) get's objects added to it during run time. This is done through instantiating a prefab.
Instantiate(DoubleInputNodePrefab, contentObject.transform);
This prefab object has the horizontal layout and two children, each an input field. If I add this prefab to content window before I run the game it works fine (expect that none of my intended code works since it relies on modularly adding and removing these objects) but I can give input and it looks fine.
WORK AROUND:
I won't consider this a solution but it is a work around I'm going with for now. Using a 'normal' input field rather than a Text Mesh Pro one doesn't create the same issues and works as intended.

VerticalLayout dynamically hiding visibility

I was wondering whats the best way around dynamically hiding some menu items. At the moment I have 6 items just in a matrix layout row. I want to have 3 items aligned left and 3 items alligned right. If one of the items is set to not visible I want it to move accross. I've done something similiar in a horizontal layout and setting the visibility to hidden. I was wondering if this would work with a vertical layout? Having trouble trying to figure out exactly how I would do it as I'm quite new to UI5 xml css and javscript. Any help would be great.
Also I'm having one other issue unrelated to this, I cant seem to bind my json model to my xml fragment, if I use the same code on my normal xml view it prints out the model data. But on my fragment it just prints it like {person>/fullName} any ideas ?
Belongs to your second question.
Maybe your binding was quoted on copy and paste? Check the native XML Code.
If no data are shown (not "{person>/fullName}"), add dependent to connect the models of your view
var oFragment = sap.ui.xmlfragment(sFragment, "fragmentName", this);
oView.addDependent(oFragment);

How can I wrap contents of a textbox that's next to a picture control?

I have the following defined in Active Reports 8 (a picture control with a border--shape--next to textbox fields):
I have more textbox fields below the two defined here, but this is just to illustrate my issue.
Anyway, how do I get the first textbox to wrap without overlapping the second textbox like below?
When I get rid of the picture and shape on the left, everything wraps as expected.
This is actually a known issue and is caused when controls are placed adjacent to each other and one side of the control has a larger height as compared to the ones on the other. Considering your example, let's say the top textbox is TextBox1 and the bottom one is TextBox2. You can handle the BeforePrint event of the Detail section and resolve this issue. For example take a look at the code below:
public void Detail_BeforePrint()
{
TextBox2.Top = TextBox1.Top + TextBox1.Height;
}
Hope this helps.

How to divide a wxPanel horizontally?

I'm building a layout for a console app and here's what I want to achieve. What I have so far is this.
My main window is deriving from a wxFrame. I split the window using wxSplitterWindow into two windows : the one on the left - a wxTreeCtrl and the one on the right is a wxPanel. My question is how to achieve the following: a horizontal list (perhaps a grid?) that shows like records from a db, but with a scroll, so that only like 20-30 are shown, and a simple textarea below this table(grid?).
I tried to split the wxPanel, just like I did with the Frame, but it doesn't work. When I tried to change the Panel to a Frame it worked, but the Frame is opened in a new window. So now I'm asking what elements to use and how to position them so that I have a scrollable table, a horizontal line, and then a simple textarea. The horizontal line should be in the middle of the left panel. Here's my code for the right panel so far:
package RightPanel;
use strict;
use base qw(Wx::Panel);
use Wx qw(:everything);
sub new {
my ($class, $parent_window) = #_;
my ($self) = $class->SUPER::new($parent_window);
return $self;
}
A wxSplitterWindow is intended for a window that can be split and unsplit at run time. Text editors often have this sort of feature so that they can offer two independent views of the same document.
I assume you will always want three independent windows in your frame? You should simply create the three windows separately and do the arithmetic to align them. It sounds like you want a wxScrolledWindow at the top and a wxPanel at the bottom.
Create a BoxSizer with wxHORIZONTAL flag for the window.
In this BoxSizer, create a Panel (your left-side area) and another BoxSizer -- with wxVERTICAL flag -- as your right-side area. (the above wxHORIZONTAL flag will put these two side-by-side).
In the right-side BoxSizer, create a ScrolledWindow (top part) and a Panel (bottom part). The wxVERTICAL flag in the right-side BoxSizer will stack these on vertically.
Sizers are tricky to get your head around if you've never played with them before... this might help:
Sizers and Layout

GWT 2.4 DataGrid automatic scrolling when selecting an item

I am using GWT 2.4's new DataGrid in a project. I configured the DataGrid with a pagesize of 50.
The available screen is not big enough to display all items and thus a vertical scrollbar is shown (this is actually the main purpose for using a DataGrid in the first place).
I attached a SingleSelectionModel to the DataGrid in order to be able to select items.
This works fine so far.
However I also have another widget with which the user can interact. Based on that user action a item from the DataGrid should be selected.
Sometimes the selected item is not in the visible screen region and the user has to scroll down in the DataGrid to see it.
Is there any way to automatically or manually scroll down, so that the selected item is visible?
I checked the JavaDocs of the DataGrid and found no appropriate method or function for doing that.
Don't know if this works, but you could try to get the row element for the selection and use the scrollIntoView Method.
Example Code:
dataGrid.getRowElement(INDEX_OF_SELECTED_ITEM).scrollIntoView();
The answer above works pretty well, though if the grid is wider than your window and has a horizontal scroll bar, it also scrolls all the way to the right which is pretty annoying. I was able to get it to scroll down and stay scrolled left by getting the first cell in the selected row and then having it scroll that into view.
dataGrid.getRowElement(dataGrid.getVisibleItems().indexOf(object)).getCells().getItem(0).scrollIntoView();
Don't have time to try it out, but DataGrid implements the interface HasRows, and HasRows has, among other things, a method called setVisibleRange. You just need to figure out the row number of the item that you want to focus on, and then set the visible range from that number n to n+50. That way the DataGrid will reset to put that item at the top (or near the top if it is in the last 50 elements of the list backing the DataGrid). Don't forget to redraw your DataGrid.
Have you already looked at this? If so, I'd be surprised that it didn't work.
Oh, and since this is one widget talking to another, you probably have some messaging set up and some message handlers so that when the user interacts with that second widget and "selects" the item, the message fires on the EventBus and a handler for that message fixes up the DataGrid along the lines I've described. I think you'll have to do this wiring yourself.
My solution, a little better:
dataGrid.getRow(model).scrollIntoView();
I got a Out of bounds exception doing the above.
I solved it getting the ScrollPanel in the DataGrid and used .scrollToTop() and so on on the ScrollPanel. However, to access the ScrollPanel in the DataGrid I had to use this comment:
http://code.google.com/p/google-web-toolkit/issues/detail?id=6865
As Kem pointed out, it's annoying the "scrollToRight" effect after the scrollIntoView. After me, Kem's solution gives a better behaviour than the base one as usually the first columns in a table are the more meaningful.
I improved a bit his approach, which scrolls horizontally to the first column of the row we want to be visible, by calculating the first visible column on the left before applying the scroll and then scrolling to it.
A final note: Columns absolute left is tested against "51". This is a value I found "experimentally" by looking the JS values in the browser's developer tool, I think it depends on the table's style, you may need to change/calculate it.
Below the code:
public void scrollIntoView(T next) {
int index = datagrid.getVisibleItems().indexOf(next);
NodeList<TableCellElement> cells = datagrid.getRowElement(index).getCells();
int firstVisibleIndex = -1;
for(int i=0; i<cells.getLength() && firstVisibleIndex<0;i++)
if(UIObject.isVisible(cells.getItem(i)) && (cells.getItem(i).getAbsoluteLeft() > 51) && (cells.getItem(i).getAbsoluteTop() > 0))
firstVisibleIndex = i;
cells.getItem(firstVisibleIndex>=0? firstVisibleIndex : 0).scrollIntoView();
}