Questions about xBBROWSE-Cell-Bitmaps in design-mode.

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Questions about xBBROWSE-Cell-Bitmaps in design-mode.

Post by ukoenig »

Hello,

I have some questions about Cell-Bitmaps
in design-mode.

I start with a empty browse.

Image

Next, i send a Bitmap to xbrowse.
The cell-height is not adjusted.
Refresh, update doesn't help

Image

When I close the dialog und reopen it.
The cell-height is ok.

Image

Now, i can fill the browser with different bitmaps.
When the end of the browser is reached,
is it possible, to clear the bmp-array ?

Image

Code: Select all


// --   xBROWSE 1, I send fonts, colors, bitmaps, styles and more --------

PRIVATE aTEST[12][3]

aTEST[1] := { " 1", "Test1", "Test1" }
aTEST[2] := { " 2", "Test2", "Test2" }
aTEST[3] := { " 3", "Test3", "Test3" }
aTEST[4] := { " 4", "Test4", "Test4" }
aTEST[5] := { " 5", "Test5", "Test5" }
aTEST[6] := { " 6", "Test6", "Test6" }
aTEST[7] := { " 7", "Test7", "Test7" }
aTEST[8] := { " 8", "Test8", "Test8" }
aTEST[9] := { " 9", "Test9", "Test9"}
aTEST[10] := { "10", "Test10", "Test10" }
aTEST[11] := { "11", "Test11", "Test11" }
aTEST[12] := { "12", "Test12", "Test12" }

oLbx1 := TXBrowse():New( oDlg7 )
oLbx1:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx1:nColDividerStyle	 := LINESTYLE_BLACK
oLbx1:nRowDividerStyle := LINESTYLE_BLACK
oLbx1:SetArray( aTEST )
oLbx1:lHScroll := .T.
oLbx1:lVScroll := .T.
// Define alternating row colors 
oLbx1:bClrStd := {|| IF ( EVAL ( oLbx1:bKeyno, NIL, oLbx1 ) %2 == 0, ;
{ CLR_BLACK, e_BRCOLOR1 }, { CLR_BLACK, e_BRCOLOR2 } ) }
 for nFor := 1 to Fcount()
      oLbx1:aCols[ nFor ]:cHeader := Padr("Font 1", 10)
      oLbx1:aCols[ nFor ]:oDataFont = xBFont1
next

oLbx1:CreateFromResource( 110 )


// The Button to send Cell-Bitmaps to browser 1
// -----------------------------------------------------

REDEFINE BUTTONBMP oBtn8  ID 260 OF oDlg7 ;
ACTION ( cNewBITM := ;
           cGetFile32("BMP-Files (*.bmp) | *.bmp","Select BMP-File"), ;
           IIF( empty( cNewBITM ), ;
                 MsgAlert( "No file selected !","ATTENTION" ), NIL ), ;
                 e_BRBMP := cFileNoExt( cNewBITM ), oBR_BMP:Refresh(), ;
           xBNEWF1(oLbx1,oLbx2,xBFont1,xBFont2), ;
           oDlg7:Update() ) ;
BITMAP "color_5" PROMPT "        &Cell-Bmp" TEXTRIGHT
oBtn8:cToolTip = { "Shows the" + CRLF + "Bitmap" + CRLF + ;
                     "of the Cell", "Cell-Bitmap", 1, CLR_BLACK, 14089979 } 


// ----- The Function to rebuild  BROWSER 1 -----------------------

FUNCTION xBNEWF1(oLbx1,oLbx2,xBFont1,xBFont2)

oLbx1:hColPen := CreatePen( PS_SOLID, e_BRPEN, CLR_BLACK )
oLbx1:hRowPen := CreatePen( PS_SOLID, e_BRPEN, CLR_BLACK )

// BR_STYLE 1 = Horz. + Vert
// BR_STYLE 2 = Horz. 
// BR_STYLE 3 = Vert

LINE + CELL - Combinations

// Horizontal + Vertical - Cell-devider with Cell-style
// ---------------------------------------------------------
IF BR_STYLE = 1
   IF BR_LINE  = 1 
       oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES
		oLbx1:nRowDividerStyle := LINESTYLE_NOLINES
   ENDIF
   IF BR_LINE  = 2 
       oLbx1:nColDividerStyle	 := LINESTYLE_BLACK       
	oLbx1:nRowDividerStyle	 := LINESTYLE_BLACK       
   ENDIF
   IF BR_LINE  = 3
       oLbx1:nColDividerStyle	 := LINESTYLE_DARKGRAY    
       oLbx1:nRowDividerStyle	 := LINESTYLE_DARKGRAY    
   ENDIF
   IF BR_LINE  = 4
       oLbx1:nColDividerStyle	 := LINESTYLE_FORECOLOR   
       oLbx1:nRowDividerStyle	 := LINESTYLE_FORECOLOR   
   ENDIF
   IF BR_LINE  = 5
      oLbx1:nColDividerStyle	 := LINESTYLE_LIGHTGRAY   
      oLbx1:nRowDividerStyle	 := LINESTYLE_LIGHTGRAY   
   ENDIF
   IF BR_LINE  = 6 
      oLbx1:nColDividerStyle	 := LINESTYLE_INSET       
      oLbx1:nRowDividerStyle	 := LINESTYLE_INSET       
   ENDIF
   IF BR_LINE  = 7
      oLbx1:nColDividerStyle	 := LINESTYLE_RAISED     
      oLbx1:nRowDividerStyle	 := LINESTYLE_RAISED     
   ENDIF
ENDIF

// Horizontal Cell devider with Cell-style
// -------------------------------------------
IF BR_STYLE = 2
   IF BR_LINE  = 1 
       oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES
       oLbx1:nRowDividerStyle := LINESTYLE_NOLINES
   ENDIF
   IF BR_LINE  = 2 
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES       
      oLbx1:nRowDividerStyle	 := LINESTYLE_BLACK       
   ENDIF
   IF BR_LINE  = 3 
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES   
      oLbx1:nRowDividerStyle	 := LINESTYLE_DARKGRAY    
   ENDIF
   IF BR_LINE  = 4
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES   
      oLbx1:nRowDividerStyle	 := LINESTYLE_FORECOLOR   
   ENDIF
   IF BR_LINE  = 5
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES   
      oLbx1:nRowDividerStyle	 := LINESTYLE_LIGHTGRAY   
   ENDIF
   IF BR_LINE  = 6 
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES      
      oLbx1:nRowDividerStyle	 := LINESTYLE_INSET       
   ENDIF
   IF BR_LINE  = 7 
      oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES     
      oLbx1:nRowDividerStyle	 := LINESTYLE_RAISED     
   ENDIF
ENDIF

// Vertical Cell-devider with Cell-style
// ----------------------------------------
IF BR_STYLE = 3
    IF BR_LINE  = 1 
        oLbx1:nColDividerStyle	 := LINESTYLE_NOLINES
        oLbx1:nRowDividerStyle := LINESTYLE_NOLINES
    ENDIF
    IF BR_LINE  = 2 
        oLbx1:nColDividerStyle	 := LINESTYLE_BLACK       
        oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES       
    ENDIF
    IF BR_LINE  = 3 
       oLbx1:nColDividerStyle	 := LINESTYLE_DARKGRAY    
       oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES    
   ENDIF
   IF BR_LINE  = 4 
      oLbx1:nColDividerStyle	 := LINESTYLE_FORECOLOR   
      oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES   
   ENDIF
   IF BR_LINE  = 5 
     oLbx1:nColDividerStyle	 := LINESTYLE_LIGHTGRAY   
     oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES   
   ENDIF
   IF BR_LINE  = 6 
      oLbx1:nColDividerStyle	 := LINESTYLE_INSET       
      oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES       
   ENDIF
   IF BR_LINE  = 7 
      oLbx1:nColDividerStyle	 := LINESTYLE_RAISED     
      oLbx1:nRowDividerStyle	 := LINESTYLE_NOLINES     
   ENDIF
ENDIF

for n = 1 to 3
     oLbx1:aCols[ n ]:cHeader = Padr("Font 1", 10)
     oLbx1:aCols[ n ]:oDataFont = xBFont1
     oLbx1:aCols[ n ]:bClrStd := {|| { BR_TCOLOR, ;
    IF ( EVAL ( oLbx1:bKeyno, NIL, oLbx1 ) %2 == 0, ;
                            BR_COLOR1, BR_COLOR2 ) } }
    IF !empty(e_BRBMP)
         // No Cell-Hight-Adjustment !!
         // --------------------------------
        cBMP := ALLTRIM(e_BRBMP) + ".BMP"
        oLbx1:aCols[ 1 ]:AddBmpFile(cBMP)
        oLbx1:aCols[ 1 ]:bBmpData := {|| oLbx1:nArrayAt }
    ELSE
        oLbx1:aCols[ 1 ]:bBmpData := NIL  // Hide Cell-Bitmap
    ENDIF
next

oLbx1:Refresh()

RETURN( NIL )


Regards

Uwe[/img]
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

If we go through the present code, xbrowse calculates the row height on the basis of bitmap heights only at the time of initialization. If we set any bitmap when the xbrowse is already open that height is not readjusted.

We do not know if FWH is planning to recalculate ( in the coming version) the row height if we add a bitmap at runtime.

But what we can do is, when we add a bitmap when the browse is running, we can also reset the oBrw:nRowHeight to fit the new bitmap height and Refresh. This will work

Code: Select all

oCol:AddBmpFile( cbmpfilename )
nHeight := ATail( oCol:aBitmaps )[ 2 ]
if oBrw:nRowHeight < nHeight  - 2
   oBrw:nRowHeight := nHeight + 2
endif
oBrw:Refresh()
Regards

G. N. Rao.
Hyderabad, India
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Row-Height of xBrowse-Cells with bitmaps

Post by ukoenig »

Hello

I checked still another version
At first i look, if the user wants to test a cellbitmap
When yes, i get the height of the testbitmap.
It works as well, but with a new test
all row-heights have the size of the new test-bitmap.
The bitmaps from the test before, are still in the array.
I think, the best way how to do it is,
to clear the bmp-array before i start to test a new bitmap.
I still have to check the sample from Mr. nageswaragunupudi
// ---------------------------------------------------------------

Code: Select all


FUNCTION xBNEWF1(oLbx1,oLbx2,xBFont1,xBFont2)
local nBmpHeight, oBmp, cBMP
......
......
IF !empty(e_BRBMP)  //  there is a cell-Bitmap
   cBMP := ALLTRIM(e_BRBMP) + ".BMP"    // User-selection
   DEFINE BITMAP oBmp FILE cBmp
   nBmpHeight := oBmp:nHeight
   oBmp:End()
ENDIF
......
......
for n = 1 to 3   // 3 Cols
  ......
  ......
   IF !empty(cBMP)
      oCol := oLbx1:aCols[ 1 ]:AddBmpFile(cBMP)
      oLbx1:aCols[ 1 ]:bBmpData := {|| oLbx1:nArrayAt }
      oLbx1:nRowHeight := nBmpHeight  // The test-bitmap
   ELSE
     oLbx1:aCols[ 1 ]:bBmpData := NIL  
   ENDIF
next
.......
.......

Regards

Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

I am not sure, but can you try this?
Whenever you make such changes, call oBrw:Adjust() and then oBrw:Refresh()
Regards

G. N. Rao.
Hyderabad, India
User avatar
Otto
Posts: 4470
Joined: Fri Oct 07, 2005 7:07 pm
Contact:

Post by Otto »

Hello NagesWaraRao,
this is a little off topic but do you think xBrowser could have variable row high depending
on the content of the row. I mean every row you see maybe another high.


Regards,
Otto

Image
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Clear Bitmap-array before new select

Post by ukoenig »

Hello,

I added just one line.
Before i start, to fill <Col 1 > with bitmaps the user selected,
I set the bitmap-arraylist to 0
( oLbx1:Adjust() i checked, there was no difference )

ASIZE( oLbx1:aCols[1]:aBitmaps,0)

Now every time, the user wants to test a bitmap,
he starts with a clean browser.
The Cell-hight is allways adjusted to the bitmap-height.

Regards

Uwe
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply