New User Stupid Questions

I’m familiar with the way GWT works, but am new to any kind of extension like smartgwt.

I am wracking my brain here, trying to figure out how to get layouts working. Everything I put on the page has massive amounts of space between it, regardless of what I think I am attempting to set it to.

VStack loginLayout = new VStack(15);
		loginLayout.setBorder("2px solid black");
		loginLayout.setWidth(300);
		loginLayout.setHeight(200);
		loginLayout.setMembersMargin(15);
		Img img = new Img("../logo.jpg",200,100);
		HStack hPanel = new HStack();
		//hPanel.setLayoutAlign(Alignment.CENTER);
		hPanel.addMember(img);
		hPanel.setBorder("2px solid blue");
		loginLayout.addMember(hPanel);
		//loginLayout.addMember(new HTML(sLOGIN));
		final TextBox userNameBox = new TextBox();
		hPanel = new HStack();
		hPanel.setBorder("2px solid blue");
		hPanel.addMember(new Label("Username:"));
		userNameBox.setVisibleLength(28);
	    hPanel.addMember(userNameBox);
	    hPanel.setMembersMargin(5);
	    hPanel.setHeight(30);
		loginLayout.addMember(hPanel);
	    hPanel = new HStack();
	    hPanel.setBorder("2px solid blue");
		final PasswordTextBox passwordBox = new PasswordTextBox();
		passwordBox.setVisibleLength(30);
		hPanel.addMember(new Label("Password:"));
		hPanel.addMember(passwordBox);
		hPanel.setMembersMargin(5);
		hPanel.setHeight(30);
		loginLayout.addMember(hPanel);
		loginLayout.setMembersMargin(15);
		loginLayout.addMember(bLogin);

is an example of how I am trying to do things and I am ending up with crazy space anywhere I don’t explicitly set the heigh and width of an object.

In regular GWT an label for example, would only be as large as it needed to be for the text in it. It doesn’t seem that is the case for smartgwt.

Am I just way on the wrong track here, or what.

This looks like a laborious attempt to recreate a DynamicForm - have you taken a look at the form examples? The defaults are not geared toward what you are trying to do because you don’t typically use a forest of Stacks and Layouts to build forms :slight_smile:

Also, setAutoFit(true) on a Label to take up minimum space.

Forms help, but I am still struggling trying to figure out how to get the extra space around HStacks to disapear.

In standard GWT, if I create a VerticalPanel vA.

Then create two HorizontalPanels hA, hB.

and vA.add(hA)
and vA.add(hB)

then the two items will be right on top of one another with minimal / no spacing inbetween unless explicity told to have spacing.

How do I control that in smartgwt. I have tried the various setMemberMargin setLayoutMargin functions with no success.

I am just working with a simple login form right now, but in the long run of the application i will end up with some rather complicated screens with different positions on the screen. I would really love to be able to control what kind of spacing, etc there is. I just can’t seem to get it down to “0” which is what I want in many cases.

Furthermore, how do I make it so text can be highlighted, right clicked and copied. Right now I can’t seem to do any of that on items that are not part of the DynamicForm. I have straight GWT items where labels are copyable text, but in smartgwt that seems to not be the case.

I am sorry for these simple questions, but there doesn’t seem to be very simple documentation for this API

As seen here: http://img519.imageshack.us/my.php?image=60025233yo6.jpg

It’s not spacing. Most components have a default size of 100x100. Use the Watch tab in the Developer Console to understand the structure of the page.

SmartGWT is geared toward screen-filling enterprise applications that try to make maximum use of available space. The default sizes of components are typically not relevant because the components are being managed within Layouts that divide all available space efficiently.

Assuming you are actually building an enterprise app, if you try using actual components instead of just empty panels, I think you’ll find that SmartGWT arranges the screen optimally and the less size settings you provide, the better.

Canvas.setCanSelectText() is how you enable text selection. But note this is already on by default in an HTMLFlow, which is the more appropriate component for showing a chunk of text.

Again, thanks. Your responses have been helpful. I have found that UI design by code can be a rough endevour in some cases.

I attached a picture earlier as an edit that shows the spacing questions I am talking about.

I will attempt to “soldier on” and make this work for what I am looking to do. Straight GWT doesn’t have all the functionality that I need so I am being forced to use something, this just seems like the best of my options.

Despite struggling to get it to work fully how I want!