X Motif client not applying scrollbars to a RowCol widget as expected - c

I have a C client for X Motif that is not showing the scrollbars for a Row Col widget as expected. The main window (toplevel) has a form added to it. In the form I add a label gadget as a top attachment to the left side. Then, I add a Quit button as a top attachment to the right side.
Then I add a ScrolledWindow widget and attach it to the form as a bottom attachment to the left side. I specify the height, width and scrollbar policy value as:
sw = XtVaCreateManagedWidget("scrolled_w", xmScrolledWidgetWidgetClass, form,
XmNwidth, 575,
XmNheight, 120,
XmNscrollingPolicy, XmAUTOMATIC,
XmNscrollBarDisplayPolicy, XmAS_NEEDED, NULL);
Inside the sw widget I create a row col widget and add a bunch of buttons
to it. They are displaying fine and going in using the orientation desired.
rowcol = XmCreateRowColumn(sw, "rowcolumn", NULL, 0);
XtVaGetValues(rowcol, XmNforeground, &fg, XmNbackground, &bg,
XmNborderColor, &bord, NULL);
XtVaSetValues(rowcol, XmNpacking, XmPACK_COLUMN,
XmNnumColumns, COLS,
XmNorientation, XmHORIZONTAL,
NULL);
The issue is when I resize the main X window, I "expect" that scrollbars
should be applied to the row col window when the size of the main window is
not letting the entire scrolled window display. But it doesn't. The only
way I can get the scroll bars to show is if I rejig the XmNwidth and XmNheight
values for the creation of the window.
Any idea why this is happening?
thx.
W.

Related

Codenameone Form content with large list objects keep bouncing back to top of form

I'm trying to create a container with a sizable number ( > 20 or a number that exceeds the screen height) of items as a scrollable list using BoxLayout, it works (ie you can see the content moving up and down when one swipes) but trying to view items at the bottom of the list always results in the content pointer going back to the top of the list. The expectation is scrolling down the list will lock the view to where the scroll action ended. I also tried using TableLayout but the results are the same. Any ideas? the mainform below also has the setScrollableY() set.
int rows = 30;
Form hi = new Form("Test",new BoxLayout(BoxLayout.Y_AXIS));
hi.setScrollableY(true);
Container contents = new Container(new BoxLayout(BoxLayout.Y_AXIS));
contents.setScrollableY(true);
hi.add(contents);
for (int i = 0 ; i < rows;i++)
{
Label type = new Label("ROW+"+i);
type.setName(i+"");
type.setTextPosition(Component.TOP);
contents.addComponent(type);
}
mainform.addComponent(hi);
Remove this line:
contents.setScrollableY(true);
You can only have one scrollable container in a hierarchy and you chose the Form. When you nest scrollables the gesture gets picked by one of them and it becomes an issue. Unlike the desktop where you can click on a specific scrollbar in a refined way, in touch devices you can't pick a specific container to scroll.

TableLayout Constraint horizontalSpan does not work

When I use horizontalSpan image does not show, however when I use widthPercentage the image perfect shows up.
How can I span the ScaleImageLabel?
My code:
TableLayout tm=new TableLayout(4,6);
tm.setGrowHorizontally(true);
Container con=new Container(tm);
con.setScrollableY(true);
hi.add(BorderLayout.CENTER,con);
TableLayout.Constraint cs;
Image icon=profilbillede.scaled(800, -1);
ScaleImageLabel lb=new ScaleImageLabel(icon);
lb.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FIT);
con.add(tm.createConstraint().horizontalSpan(2),lb);
The code below works because I removed the span. A table needs to calculate column widths automatically unless you explicitly tell it the with of the column.
When you use span we don't know if the width applies to the 1st or 2nd column so it's ignored with the assumption that you have a reason for spanning and not using one column. In that case you would define the width in a different cell either via preferred size or via the width element.
As a side note there is no need to scale the image before adding it to the ScaledLabel you would be doing double the scaling which degrades the appearance of the image.
Form hi = new Form("Table", new BorderLayout());
TableLayout tm=new TableLayout(4,6);
tm.setGrowHorizontally(true);
Container con=new Container(tm);
con.setScrollableY(true);
hi.add(BorderLayout.CENTER,con);
TableLayout.Constraint cs;
Image icon=duke.scaled(800, -1);
ScaleImageLabel lb=new ScaleImageLabel(icon);
lb.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FIT);
con.add(tm.createConstraint(),lb);
hi.show();

Windows Phone 7 Scoll to Grid's first element

In my WP7 application, I have pager at the end of the page, so people can navigate prev and next.
When I call 2nd page, Grid loads with new items fine but it stays wherever user left the scroll position.
When I was using ListBox element, I achieved this like this;
ListBox1.UpdateLayout();
ListBox1.ScrollIntoView(ListBoxEntries.Items[0]);
but Grid object does not contain ScrollIntoView function. Is there any workaround for this problem?
You can programmatically change the scroll offset of the ScrollViewer like this:
ScrollViewer scroll = myScrollViewer;
Double verticalOffset = 0; //0 for top, otherwise some calculated value.
scroll.ScrollToVerticalOffset(verticalOffset);

Show Hide Silverlight Controls from the page

I have a dataGrid control on the page and below this grid there are some text boxes. in some conditions I dont want to display the grid on the page. For this I have used
dg.Visibilty = Visibilty.Collapse;
It will successfully hide the datagrid, which is fine, but the space that is consumned by the grid is still disply on the page, what I want is when my grid is hidden then controls will shift up automatically just like style=display:none ;
Thanks
What you are doing should work fine.
It might be that the container which contains your data grid might have some height width assigned.

realign dropdown box after form resize

I have a winform app. On the menu bar, far right, I placed a dropdown box on top of it. When I resize the form the dropdown box obviously stays in the same position (x,y location). How can I get it to move propotionally to the right when the form is resized. It basically stays on the same Y axis.
I can't use a layout control since it's placed on top of the menu.
You can use the Anchor property of the comboBox to do this. Simply set it to Right (probably Top and Right) through the designer.
Or to do it in code:
comboBox1.Anchor = AnchorStyles.Right;

Resources