How to alignment Bitmap in XBrowse?

How to alignment Bitmap in XBrowse?

Postby dutch » Thu Mar 13, 2008 11:23 pm

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby nageswaragunupudi » Fri Mar 14, 2008 12:44 am

> 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: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby nageswaragunupudi » Fri Mar 14, 2008 12:47 am

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby dutch » Fri Mar 14, 2008 1:35 am

Thanks, I'll try.

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Otto » Fri Mar 14, 2008 6:30 am

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
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby nageswaragunupudi » Fri Mar 14, 2008 8:13 am

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  Expand view
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  Expand view
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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby dutch » Fri Mar 14, 2008 9:11 am

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby nageswaragunupudi » Fri Mar 14, 2008 10:54 am

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby dutch » Fri Mar 14, 2008 2:37 pm

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby nageswaragunupudi » Fri Mar 14, 2008 3:32 pm

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
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby dutch » Sat Mar 15, 2008 2:47 pm

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
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Antonio Linares » Sat Mar 15, 2008 3:03 pm

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: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Mar 15, 2008 7:13 pm

Dutch,

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

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

Postby nageswaragunupudi » Sun Mar 16, 2008 4:50 pm

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

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

Postby nageswaragunupudi » Sun Mar 16, 2008 4:52 pm

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests