Page 1 of 1
How to alignment Bitmap in XBrowse?
Posted: Thu Mar 13, 2008 11:23 pm
by dutch
Dear Antonio,
I've problem with bitmap show align incorrectly.
JUSTIFY cluase is only .T., .F. (Right, Left). Can I align as CENTER?
Regards,
Dutch
Posted: Fri Mar 14, 2008 12:44 am
by nageswaragunupudi
> JUSTIFY cluase is only .T., .F. (Right, Left). Can I align as CENTER?
JUSTIFY clause is accepting numerics also. If you want to specify CENTER, specify AL_CENTER
example:
JUSTIFY .T., .F., AL_CENTER, AL_RIGHT, .F. ......... etc
We can mix logical and numeric alignment specifications.
> I've problem with bitmap show align incorrectly.
Justify clause applies to data only. If we want to justify bitmaps, we should assign alignment values AL_LEFT or AL_RIGHT to oCol:nDataBmpAlign. ( or oCol:nHeadBmpAlign, oCol:nFootBmpAlign) separately.
Till now, only left and right alignments are possible for bitmaps.
Posted: Fri Mar 14, 2008 12:47 am
by nageswaragunupudi
In any case, painting bitmaps left of the separator is incorrect. I can not find a reason. For me the bitmaps are painting correctly. I am not sure but please try increasing the width of the column.
Posted: Fri Mar 14, 2008 1:35 am
by dutch
Thanks, I'll try.
Regards,
Dutch
Posted: Fri Mar 14, 2008 6:30 am
by Otto
Dutch, what version of FWH do you use.
There was a problem with bitmaps:
xbrowse cols smaller than bmp or row lower than bmp height
http://fivetechsoft.com/forums/viewtopi ... ht=bitmaps
Regards,
Otto
Posted: Fri Mar 14, 2008 8:13 am
by nageswaragunupudi
I am going throufh the code of FWH and Mr. Otto's suggestion.
It appears that the intention is to paint the bitmap at center if there is no data and paint left or right when data is present and based on the value of nBmpAlign.
When there is no data, the start column of the bitmap is calculated as
Code: Select all
nBmpCol := nCol + ( ( nWidth - aBitmap[ BITMAP_WIDTH ] ) / 2 ) + 2
The calculation works fine if bitmap's width is less than the column width. But if the bitmap's width higher than the column width, nBmpCol is negative. That is what must have happened in these cases.
First quick fix we can apply is :
Code: Select all
nBmpCol := nCol + Max( 0, ( ( nWidth - aBitmap[ BITMAP_WIDTH ] ) / 2 ) )+ 2
This fix will not fit the bitmap well in the column, but atleast will not paint to the left of the column.
This raises the queston, how and when can the column width and column height can be lesser than the bitmap width?
I think this can happen for any of the three reasons.
1) User manually specifying column's width or row height less than bitmap's width or height.
2) User specifying the bitmap after oBrw:CreateFromCode.
3) The initial calculation of coulmn width and row height in the methods datawidth() and dataheight() is not perfect.
We know that all browses automatically calculate the column width on the basis of evaluated values of the first row of data. XBrowse is no exception. Column width is calculated by xbrowse on the basis of the width of the bitmap evaluated in the first row of data. If there is a larger bitmap in other rows, the width can not accommidate.
The solutions perhaps would be to
(a) revise datawidth and dataheight methods to take into account the dimensions of the largest of the bitmaps in abitmaps data.
and/or
(b) use transbmp in paintdata method instead of PalBmpDraw, to fit the bitmap to the size available,
These are some thoughts .
[/code]
Posted: Fri Mar 14, 2008 9:11 am
by dutch
Dear Otto,
I've used latest version 8.03 and BMP file is smaller than column width
Regards,
Dutch
Posted: Fri Mar 14, 2008 10:54 am
by nageswaragunupudi
Mr Dutch
If you don't mind can you please tell me if the bitmap apprears correctly if you increase the width of the column manually ?
Posted: Fri Mar 14, 2008 2:37 pm
by dutch
Dear nageswaragunupudi,
I try to increase width upto 45, the result is ok. The bitmap is in the column and keep left.
Regards,
Dutch
Posted: Fri Mar 14, 2008 3:32 pm
by nageswaragunupudi
That means column width is less than bitmap width. Have you manually assigned nWidth of the column? In that case, please do not assign the width manually in the program and recomple. Let us see if the browse calculates the column width to accommodate the bitmap width properly. I have seen the code. If the first row shows this bitmap, browse calculates the column width to accommodate the bitmap width.
Posted: Sat Mar 15, 2008 2:47 pm
by dutch
Dear nageswaragunupudi,
I try without specific fieldsize as this picture;
This is the one I manual set fieldsize
oBrw:aCols[5]:nDataBmpAlign := AL_LEFT or AL_RIGHT is not effect. It still show the same position.
nageswaragunupudi wrote:That means column width is less than bitmap width. Have you manually assigned nWidth of the column? In that case, please do not assign the width manually in the program and recomple. Let us see if the browse calculates the column width to accommodate the bitmap width properly. I have seen the code. If the first row shows this bitmap, browse calculates the column width to accommodate the bitmap width.
Regards,
Dutch
Posted: Sat Mar 15, 2008 3:03 pm
by Antonio Linares
Dutch,
We have an improved Class TXBrowse that properly aligns the bitmaps and the texts.
We are going to publish a new release for 8.03, probably today
Posted: Sat Mar 15, 2008 7:13 pm
by Antonio Linares
Dutch,
Already published. Please download it again, thanks
Posted: Sun Mar 16, 2008 4:50 pm
by nageswaragunupudi
Downloaded just now and tried.
Bitmaps are aligned properly now.
Thanks
Posted: Sun Mar 16, 2008 4:52 pm
by nageswaragunupudi
Also alignment of text columns to center and right is working properly now, as can be seen in the above image. Earlier it was not so,