center text vertically in twolinesandbitmap - basic4android

I've attached some sample code with the issue. I create a listview with two lines and a bitmap. I disable the second label so I have just the image and one lable. I want to center the text vertically, can't seem to figure it out!!
Sub Globals
Dim listview1 As ListView
Dim bitmap1 As Bitmap
End Sub
Sub Activity_Create(FirstTime As Boolean)
bitmap1.Initialize(File.DirAssets, "fldricon.gif")
Listview1.Initialize("listview1")
ListView1.TwoLinesLayout.Label.TextSize=18
ListView1.TwoLinesLayout.ItemHeight=60
ListView1.TwoLinesAndBitmap.SecondLabel.Visible=False
ListView1.TwoLinesAndBitmap.SecondLabel.Enabled=False
ListView1.TwoLinesAndBitmap.SecondLabel.RemoveView
Listview1.TwoLinesAndBitmap.Label.Gravity=Gravity.CENTER_VERTICAL
activity.AddView(listview1,0,0,50%x,100%y)
Listview1.AddTwoLinesAndBitmap("some string","",bitmap1)
End Sub
I've disabled the second label as you can see but the first label will not center vertically. Any and all help will be most appreciated!! Thanks

Two tips:
Use dip units when specifying screen sizes:
ListView1.TwoLinesLayout.ItemHeight=60dip
Set the label color to nonblack color to see the layout of the label. You will then see that the label doesn't changes its size when you hide the second label.
The solution is:
ListView1.TwoLinesAndBitmap.Label.Height = ListView1.TwoLinesLayout.ItemHeight

Related

Resizing Panels in proportion to form

I am developing a Delphi game for my (grade 10) PAT.
I am using an image as a grid for my game and placing individual panels in each grid because I do not know how to use string grids as it's my first year with Delphi. When I place the panels perfectly in each grid of the image and run my code everything looks normal until I go full screen,then all the panels are in each grid but the size is not in proportion with the image as I placed it before.
A solution would be much appreciated.
Thanks in advance.
Use a TGridPanel in place of your image. Each panel goes into one cell of the grid, and with the column widths and row heights set as a percentage (which is the default), and both the grid and the panels in the grid having Align set to alClient, the cells, and therefore the panels, will adjust their size proportional to the entire form.

What's the proper way to align a strechable Text and an image to two ends in Unity UI?

I have an UI element that has a Text and an Image as its children. It has a HorizontalLayoutGroup component that enables Control Child Size and Child Force Expand.
I want the Image has a fixed size, and Text has strechable size controlled by the HorizontalLayoutGroup. So when the Image is set to inactive, the Text fills the whole space and when the Image is active, the Text shrinks a little bit in order to give space to the Image. Right now this part works good.
My second goal is to align them to both ends: the Text in the left and the Image on the right with space in between. But changing Child Alignment can't achieve this.
I tried the following solution:
Add LayoutElement both to Image and Text. On Text, enable Flexible Width and set a a value, on Image, enable Min Width and set to a value. Manually adjust the two values until it seems right.
This solution seems to work, but I don't know why. Is anyone familiar with this?What's the recommended way to do it? Thanks!
I worked it out. On the LayoutElement, treat Preferred Width or Preferred Height as Max Width or Max Height. Enable them, set the value the same with min value. One the other objects that you want to stretch, enable Flexible values. Then all worked as we want.

iWatch: WKInterfaceLabel is it possible to stop text from being cut off with "..." at the end of a label?

The text in my WKInterfaceLabel is way too long and causes the text to be cut off with dots at the end. I know for UILabel for iOS you can easily resolve this issue by enabling clip mode. I don't believe there is any way for me to resolve this for watchkit. This is going to force me to use an Image if I can't prevent the text from being cut off. Any tips or suggestions is appreciated.
You have a couple options depending on how you want the view to respond. In your interface story board select your label and open the attributes inspector.
Your first option is to change the font to a smaller size. This is more for a static label that you want to style and leave set.
Your second option is to adjust the min scale value, changing this will automatically shrink the text to fit the window up to the value provided. For example if your font size is 12pt and you set the scale to .5, the font will shrink up to 6pt before appending the ellipsis (...).
Your third option is to set the number of lines to 0 (or a higher number). This will move the text down onto the next line.
Set the number of lines to 0 and ensure the label and any containing groups are set to fit content.
if you want your font size adjust according to label size follow this method
in WKInterfaceTable attribute inspector set min scale to 0
like in screen shoot
Result before Min scale = 0
Result after Min scale = 0
Note: your no of lines also set to 1

How to create vertical line in iReport?

I'm using iReport-3.7.4 ,
I want to make table in detail like this ,
but , the line in this table can't longwise until the end of the table,
I've placed this table in detail ..
In iReport, Right Click on a Field, and goto Padding and Borders and set Line width to 1. As shown below:
Put the repetitive things in sub-report and draw the vertical lines in appropriate margins. Load the sub-report in the main window with its width tallies with the parent width. Test & modify the report again an again till you get the lines in the correct places. Moreover make sure you have checked on Print Repeated Values property for the line.
I've attached some reports I've created for my project, hope they can explain you well.
The Parent Report
The Sub-Report
The Final Output
If you really want to draw a line then just drag line element from palette and drag the bottom middle point of that tile element to increase the size and then decrease the width by dragging left middle point.

GTK+ widget background image alignment

I set background image for a button by:
bg_pixmap[NORMAL] = "img.png"
but most of the times the image is offset with certain x, y when:
there is padding around
there is adjacent widgets at left/top
align the button 0.5, 0.5 of an alignment container of larger size
...
how can I specify the background image to alway start from 0, 0 of the button?
EDIT
it seems bg_pixmap is always tiling start from 0, 0 of the window ( but shown only in the button area )....
but when I use bg_pixmap on widgets not has state changes (only NORMAL image is shown), the image is aligned correctly... (e.g. drawing area, event box, etc...)
Looks that Gdk::Window::set_back_pixmap is the function you are looking for. Point is the parent_relative boolean that change the tiling starting point.
C. F.
WORKAROUND
I worked around this and make an "image button" works with rc style file:
add GtkButton inside an EventBox
EventBox -> Visible Window = Yes ( No won't make it work )