How to add padding in two widgets positioned vertically with in libgdx? - libgdx

I am working in libgdx, I have three containers c1,c2,c3. C1 is above c2 and c2 is above c3..
My code is like this
maincontiner.add(c1)
maincontiner.add(c2)
maincontiner.add(c3)
Now I need to add some space between c2 and c3. So what I do is that, I add padTop while adding c3; for ex
maincontiner.add(c3).padTop(10)
But doing this affects the position of c1,c2. Why is that? When I am padding to c3, should the above two containers be moves as well? Is there any way to avoid their movement?

You should call row() method after each add to place containers one above one:
maincontiner.add(c1).row();
maincontiner.add(c2).row();
maincontiner.add(c3).padTop(10).row();
Please refer this article to undetstand how table layout works.

Related

How to avoid css overlapping?

I'm using FullCalendar with the resource library that you can see in my JSFIDDLE
How you can see the problem of the resource (first column, second column) is the overlapping. Seems infact if the resource have a long name go to overlap the near column and this is bad for me. What I want is cut the resource name if exceeds a certan lenght, anyway, the label must not overlap the next cell.
Issue image:
Final result
Something like: First col | Second col
You seem to want to hide the overflow.
Your calendar's table header elements are overflowing into each other.
CSS:
#calendar tr th div.col-label{
overflow-x: hidden;
}
This will make the overflowing text not draw instead of drawing on the next cells.
EDIT: Fixed this making the events disappear
EDIT 2: Fixed messing up the Date Label
Another way to solve your problem is by setting a min-width property on your columns in order to ensure that each one will have enough space available to store it's data. And then use width:100%; property on your labels. Maybe use some padding as well in order to make it look nice. Let me know if this helped :)

CSS Float not working correctly

Please go through fiddle. Here I am presenting the information TV seasons in the form of lists. I am managing these lists to appear next-each-other through setting FLOAT left/right. Some-how few of the lists are not appearing properly.
Any assistance is appreciated.
You can check fiddle
You cannot acheive that look-n-feel with current structure of HTML and css. You will need to
Create columns - for now I have created 3 columns - you may create as many columns as you want. Further these number of columns can be made specific to RESPONSIVE WEB BREAKPOINTS if you want to make this page responsive.
Associate season lists to each column
Apply float:left to each column
Get rid of lef and right div classes
Rather apply this float to columns as mentioned in # 3
Please visit the demo # https://jsfiddle.net/zm11awhq/5/embedded/result/
If you dont want to use columns then you will need to give min-height to each season's div. This min-height will remain standard for all the sasons so floating will take place very properly. But this will keep lot of white space on the page.
I figured it out by myself i just added clear: left; on left class and clear: right; on right class it fix`s the season which isnt displayed correctly and rest will shows as it is.
Thank you for everyone of your help.

UiApp Merge 2 Cells in a Grid

In Google Apps Script UiApp, is there any way to merge 2 adjacent cells in a Grid?
Quick link to Grid doc
Looking through it, I see nothing about merge capability. Take the following example:
What I want to do is merge the cells # [0,5] and # [1,5] So that the TextArea for Description is a bit better-centered.
Is there any possible way to do this at the current time? I don't want to have to revert to using Flex Table for this... is that my only option? Are there any other workarounds like embedding the encircled elements in another panel or something similar?
Solution: CSS margin properties on the Grid or Widgets (through setStyleAttributes()). Apparently this is the behavior of Widgets in a Grid: CSS styles almost bypass Grid constraints; i.e., if you set a bizarre bottomMargin on a Widget, it can almost move out of the Grid, which acts as a "centering" between two cells. So I just did the following:
textArea.setStyleAttribute("marginBottom", "-75px"); which gave the following result:
I'd try using 2 grids, one with the textArea (and the 5 widgets of the first row) and the other with the other elements...
This latter should have a negative top margin to allow you to get the right vertical distribution on the 5 first left widgets.
I didn't try the negative margin but it should work.
Let me know if you try it :-)

Separate label from textbox

Is there a way to separate a label from a textbox?
I found that this is supposed to work :
Select the controls
Arrange tab
Remove layout
But the remove layout button is always disabled... Probably cause it's only when you use the tabular or stacked option
Is there any other way to do it, or am I doing something wrong?
Please, don't tell me that I have to copy/paste the label and delete the original one.
Thank you
To move a text box (or any control) independently from its label is to click and drag the control using the large grey box in the top left of the control. This allows you complete freedom of placement between the control and label.
Remove layout only works if you use either tabular or stacked.
Use the square at the top right to move them separately, and select only the label to delete the label.
Just select the one you want to use only, and it can be controlled separately. Also: width, height, top, and left in the properties tab are your friends.
Use remove layout if you can select that little cross.
Use the align buttons to tidy up this mess.
I do not use Access much so I find letting Access create all the labels is quicker, when separating the label from the data I use the following method.
Click the label
Ctrl+C to copy label
Delete to remove label
Ctrl+V to paste label back to form
Drag from top left to roughly the location you want
If you have a column of labels then do the cut/copy/paste/reposition for all of them first, then use the method Fionnuala shows to align all to right.
If the labels are too far to the left or right the use the cursor keys to move.
Again use Fionnuala method to align the rows.
If you find they do not align as expected then Ctrl+Z to step back.
If Remove Layout is not available, select Stacked, which will make Remove Layout available, and then select Remove Layout.
This also keeps things where they are, so less re-aligning afterwards.
I think I've got the right answer. Select the Label and send click "Send to back" on Arrange Tab. Label will be detached. Now move it anywhere as required.

How to create a custom GControl

I'm trying to create a gray "frame" (see pic below) around a google map, to try to convey the concept of an area of focus, as oppose to a point (which is usually represented with a marker). Note that this is not an overlay, that is, the gray "frame" should not move when you drag the map.
Edited: image link added
It appears that only option is to "subclass" GControl to create a custom control. I have 3 questions
1) First of all, is GControl subclassing the best course of action?
2) In my example, the canvas (div) where map renders can change its size (i.e is not fixed width). Do I have to delete and add custom control when canvas changes size? See docs http://code.google.com/apis/maps/documentation/controls.html#Custom_Controls on how to create a custom map control.
3) Now, how to do it. Naively, I thought I could create a table with 3 columns and 3 rows, and set display: none for the cell in the middle. But that doesn't work. I've also experimented with clipping, that didn't work either. My css skills are quite lacking, so there must be way to do this more elegantly than adding four rectangular gray divs. If I wanted to add an inner border, with divs, I would need to paint 8 then. In a nutshell, what's the best way to create a "hollow" rectangle?
Thanks
P.S. This is my first entry to StackOverflow. Just discovered it. It's impressive how well SO is put together.