How to alignment Bitmap in XBrowse?

Post Reply
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

How to alignment Bitmap in XBrowse?

Post 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?
Image
Regards,
Dutch
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Thanks, I'll try.

Regards,
Dutch
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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]
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear Otto,

I've used latest version 8.03 and BMP file is smaller than column width
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
Regards,
Dutch
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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 ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post 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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
dutch
Posts: 1395
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Post by dutch »

Dear nageswaragunupudi,

I try without specific fieldsize as this picture;
Image

This is the one I manual set fieldsize
Image

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Dutch,

Already published. Please download it again, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Downloaded just now and tried.
Bitmaps are aligned properly now.
Image
Thanks
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post 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,
Regards

G. N. Rao.
Hyderabad, India
Post Reply