xBrowse cell overlaps

xBrowse cell overlaps

Postby frose » Thu Apr 29, 2010 2:53 pm

Dear Rao,

is it possible to overlap (free) cells in xBrowse, like it is in Excel?

Little screen shot, showing overlapped cells in Excel:
http://depositfiles.com/files/3bb77rcog
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse cell overlaps

Postby Marcelo Via Giglio » Thu Apr 29, 2010 3:53 pm

Hello,

I think this id not possible with the native xBrowse, you need to change the code, maybe can be possible to add a data (object attribute) to change the paint behavior

In the PaintData Method of TXBrwColumn Class change the follow lines

Code: Select all  Expand view
     
//DrawTextEx( hDC, cData,;
//            {nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) },;
//            ::nDataStyle )

Draw TextEx( hDC, cData,;
                   { nRow, nCol, nRow + nHeight, nCol + GetTextWidth( hDC, cData ) },;
                     ::nDataStyle )
 


this is a simple test, I am using very old version of xBrowse ( I don't update my FW yet :-) ), please test and comment

saludos

Marcelo
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: xBrowse cell overlaps

Postby frose » Fri Apr 30, 2010 8:27 am

Hi Marcelo,

thank you very much for your code snippet.

It works for the last column, see screen shot:
Image

But it doesn't work for (empty) cells, as shown here:
Image

Do you have an idea to change the code for overlapping (empty) cells?

Even better: switch (property) for each column with the following values:
- Do not overlap cells
- Overlap only empty cells
- Overlap cells even if they are not empty
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse cell overlaps

Postby nageswaragunupudi » Fri Apr 30, 2010 11:21 am

>>
I think this id not possible with the native xBrowse, you need to change the code, maybe can be possible to add a data (object attribute) to change the paint behavior
>>
This observation is not correct.

If oCol:bPaintText is assigned with our codeblock, xbrowse does NOT paint cell text on its own and instead calls our codeblock with the parameters ( oCol, hDC, cData, aRect, aColors, lHighLite ). It is for the programmer to use this facility,
Regards

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

Re: xBrowse cell overlaps

Postby frose » Fri Apr 30, 2010 12:39 pm

Rao,

If oCol:bPaintText is assigned with our codeblock, xbrowse does NOT paint cell text on its own and instead calls our codeblock with the parameters ( oCol, hDC, cData, aRect, aColors, lHighLite ). It is for the programmer to use this facility,


So, we can achieve the above described behaviour with the actual version of xBrowse!?

If so, please give me some more advices, what I have to do. Here is my sample code:

Code: Select all  Expand view
FUNCTION Main()

   LOCAL oDlg, oBrw, oCol, aRecord, nAt := 1
   
   USE Customer
   
   aRecord = Array( Customer->( FCount() ) )
   
   DEFINE DIALOG oDlg SIZE 300, 300

   @ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT

   oCol := oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
   oCol:cHeader = "FieldName"  

   oCol := oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
   oCol:cHeader = "Value"  

   oCol := oBrw:AddCol()
   oCol:bStrData = { || "" }
   oCol:cHeader = "Empty"  
   oCol:bPaintText = { || NIL }
   
   oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW

   oBrw:CreateFromCode()
   oBrw:bKeyCount = { || Customer->( FCount() ) }
   
   oDlg:oClient = oBrw  
     
   ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()
     
RETURN NIL
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse cell overlaps

Postby Marcelo Via Giglio » Sat May 01, 2010 8:57 pm

Hello,

I think Mr. Rao is right, what happend is I worked with very old xBrowse source :-)

Code: Select all  Expand view
 
...
if !Empty( cData )
      oFont:Activate( hDC )
      SetTextColor( hDC, aColors[ 1 ] )
      SetBkColor( hDC, aColors[ 2 ] )
      //DrawTextEx( hDC, cData,;
      //            {nRow, nCol, nRow + nHeight, Min( nCol + nWidth, ::oBrw:BrwWidth() - 5 ) },;
      //            ::nDataStyle )
         DrawTextEx( hDC, cData,;
                     { nRow, nCol, nRow + nHeight, nCol + GetTextWidth( hDC, cData ) },;
                     ::nDataStyle )
      //-------------------------
      oFont:Deactivate( hDC )
   endif
...
 


The xbrowse's source has only 4561 lines

I am sorry, I will try to see it with other xBrowse version

regards

Marcelo
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: xBrowse cell overlaps

Postby frose » Mon May 03, 2010 9:06 am

Dear Marcelo, dear Rao,

I've adopted your proposals and now my sample code looks as follows:
Code: Select all  Expand view
FUNCTION Main()

   LOCAL oDlg, oBrw, oCol, aRecord, nAt := 1
   
   USE Customer
   
   aRecord = Array( Customer->( FCount() ) )
   
   DEFINE DIALOG oDlg SIZE 300, 300

   @ 0, 0 XBROWSE oBrw OF oDlg ARRAY aRecord // AUTOSORT

   // 1. column
   oCol := oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldName( oBrw:nArrayAt ) ) }
   oCol:cHeader = "FieldName"  

   // 2. column
   oCol := oBrw:AddCol()
   oCol:bStrData = { || Customer->( FieldGet( oBrw:nArrayAt ) ) }
   oCol:cHeader = "Value"  
   
   // Overlapping this column
   oCol:bPaintText = { | oCol, hDC, cData, aRect | DrawTextEx( hDC, cData, { aRect[ 1 ], aRect[ 2 ], aRect[ 3 ], aRect[ 2 ] + GetTextWidth( hDC, cData ) }, oCol:nDataStyle ) }
   
   // 3. column
   oCol := oBrw:AddCol()
   oCol:bStrData = { || "abc" }
   oCol:cHeader = "Empty"  
   // Don't draw this column
   oCol:bPaintText = { || NIL }
   
   oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW

   oBrw:CreateFromCode()
   oBrw:bKeyCount = { || Customer->( FCount() ) }
   
   oDlg:oClient = oBrw  
     
   ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()
     
RETURN NIL
 

Even though the third column draw nothing, it still overwrites the content of the second column!

Any ideas?
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse cell overlaps

Postby frose » Mon May 03, 2010 12:25 pm

Hi to all,

one possible solution is, setting

Code: Select all  Expand view
oCol:lColTransparent := .T.

but the content of the selected row disappears:

Image

And color settings has no effect for transparent cells :(

Code for the column 'Empty':
Code: Select all  Expand view
oCol:bClrStd := { || { CLR_BLACK, CLR_CYAN } }
oCol:lColTransparent := .T.

the cell doesn't change the color:
Image

Any ideas?
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse cell overlaps acc. merge columns

Postby frose » Fri May 07, 2010 7:32 am

Another much more better solution:

Merge columns similar to merge rows, see testmerg.prg

Unfortunately this feature is not (yet) implemented in xBrowse.
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 122 guests