Page 1 of 1
Listbrowser centering
Posted: Wed Mar 09, 2016 9:11 pm
by mritter0
I am trying to center an image in a listbrowser column, but the values are incorrect (?)
Code: Select all
IListBrowser->SetListBrowserNodeAttrs(node,
LBNA_Column, ci,
// LBNCA_HorizJustify, LCJ_CENTER, // RIGHT
// LBNCA_HorizJustify, LCJ_LEFT, // CENTER
// LBNCA_HorizJustify, LCJ_RIGHT, // RIGHT
LBNCA_Image, ContentNode->ImageLabel,
TAG_DONE);
With nothing specified the image is centered. According to the AutoDoc left is the default.
If I specify LCJ_CENTER it right aligns.
If I specify LCJ_LEFT it is centered.
If I specify LCJ_RIGHT it is right aligned.
It appears to just be when use LBNCA_Image because LBNCA_Text works just fine.
V53.62
Re: Listbrowser centering
Posted: Thu Mar 10, 2016 7:24 pm
by broadblues
I just modified the LB_Example.c to repeat the label image with left center right justification and it works okay see atached grab.
Do you have specific bit of example code that repeats your issue?
What kind of image object are you adding (small chance the issue might be with the image not the browser).
Re: Listbrowser centering
Posted: Fri Mar 11, 2016 1:40 am
by mritter0
After some trials it turns out it is centering correctly. There is extra padding on the left side of the column that moves the image (and text) in a bit (All of the columns have it). In my case, with a narrow column, those extra pixels pushed it to the right, looking not centered. Wouldn't have noticed it with a wider column and image.
Re: Listbrowser centering
Posted: Sun Mar 13, 2016 6:05 pm
by mritter0
Maybe I am not totally crazy, just partially.
I am using AISS image "list_drawer" which is 16x16. I did some more testing with my column widths.
Width: 22, LCJ_LEFT

- LCJ_LEFT_1.png (2.93 KiB) Viewed 11138 times
This looks centered, at least on the striped lines.
Width: 22, LCJ_CENTER

- LCJ_CENTER_1.png (2.64 KiB) Viewed 11138 times
This looks right aligned, mostly, but not centered.
Width: 32, LCJ_CENTER

- LCJ_CENTER_2.png (2.4 KiB) Viewed 11138 times
Still not centered, still to the right a 4 pixels.
Re: Listbrowser centering
Posted: Sun Mar 13, 2016 6:13 pm
by mritter0
(only 3 attachments per post allowed)
Width: 50, LCJ_CENTER

- LCJ_CENTER_3.png (2.5 KiB) Viewed 11137 times
Still 4 pixels to the right of center.
Width: 50, LCJ_LEFT

- LCJ_LEFT_2.png (2.59 KiB) Viewed 11137 times
Not all the way to the left, 2 pixels to the right.
So is there some padding on the left that is moving the images to the right? It is not truly being centered.
Side note: Why is the striping not all the way to the left/right? It makes the centering look even more off. It is 4 pixels indented, the images are off by 4 pixels......
Re: Listbrowser centering
Posted: Sun Mar 13, 2016 9:48 pm
by xenic
mritter0 wrote:Width: 50, LCJ_LEFT
LCJ_LEFT_2.png
Not all the way to the left, 2 pixels to the right.
So is there some padding on the left that is moving the images to the right? It is not truly being centered.
Assuming that your drawer images are TBImage drawer images, there are 2 pixels of border on the left of the actual drawer image that are being blended into the background by the PNG alpha channel. If you look closely at the drawer image in your attachment it isn't perfectly rectangular. That's because the image is being blended into the background by the alpha channel. The actual image in the file is larger than what you see on the screen. You can load the TBImages drawer image into PPaint or ImageFX and you will see that it's actually rectangular with a border around the little drawer picture.
Re: Listbrowser centering
Posted: Mon Mar 14, 2016 1:21 am
by mritter0
The image is 16x16 with 1 pixel blank on each side. I accounted for that.
Load one of my images in a paint program and zoom in max and count the pixels.
Two pixels doesn't sound like a big deal until you have a narrow column with small images.
Re: Listbrowser centering
Posted: Mon Mar 14, 2016 6:37 pm
by xenic
mritter0 wrote:The image is 16x16 with 1 pixel blank on each side. I accounted for that.
Load one of my images in a paint program and zoom in max and count the pixels.
Two pixels doesn't sound like a big deal until you have a narrow column with small images.
O.K. I was looking at the wrong TBImage and the 16x16 list_drawer doesn't have the extra border pixels. I grabbed a number of Reaction windows and it appears that even when the leftmost items are text, there is a 4 pixel space between the window border and the items in a lister. It does seem that the extra 4 pixel space is not being taken into account when the object position is calculated.
Re: Listbrowser centering
Posted: Thu Mar 17, 2016 11:42 pm
by mritter0
It's not due to the striping effect. Even without it it still is off.
LCJ_LEFT

- LCJ_Left.png (1.69 KiB) Viewed 11061 times
LCJ_CENTER

- LCJ_Center.png (1.76 KiB) Viewed 11061 times