How to alignment Bitmap in XBrowse?
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
> 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.
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.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
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
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
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
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
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 :
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]
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
First quick fix we can apply is :
Code: Select all
nBmpCol := nCol + Max( 0, ( ( nWidth - aBitmap[ BITMAP_WIDTH ] ) / 2 ) )+ 2
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]
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Dear Otto,
I've used latest version 8.03 and BMP file is smaller than column width
Dutch
I've used latest version 8.03 and BMP file is smaller than column width
Regards,Otto wrote: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
Dutch
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
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
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
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.
Dutch
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.
Regards,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.
Dutch
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact: