New useful addition to xBrowse

New useful addition to xBrowse

Postby byte-one » Mon Feb 29, 2016 9:18 am

Many of my clients said, that the active cell for edit not so clearly visible (depending from MARQSTYLE). So i think, a border around the active cell can be useful.
My code (not perfect in the sense of Mr. Rao :D) :

First in classes TXbrowse and TXBrwColumn
Code: Select all  Expand view
// BOX AROUND CELL
   DATA nBoxPen AS NUMERIC INIT 0   //box linewidth //BYTE-ONE
   DATA nColorBoxPen AS NUMERIC INIT CLR_WHITE //boxpencolor    //BYTE-ONE
 

Then in method :drawline() add lines with BYTE-ONE in text
Code: Select all  Expand view
.....
         RoundBox( hDC, 2, nRow - 1, nLast - 1, nRow + nDataHeight,     2, 2,;
                   RGB( 235, 244, 253 ), 1 )
         RoundBox( hDC, 1, nRow - 2, nLast,     nRow + nDataHeight + 1, 2, 2,;
                   RGB( 125, 162, 206 ), 1 )

      endcase
      oCol := ::ColAtPos( ::nColSel )   //BYTE-ONE
      if oCol:lEditable //only on edit-cells //BYTE-ONE
        if oCol:nBoxPen > 0//Box for this cell //BYTE-ONE
                oCol:Box( nRow, nil, nDataHeight, 4,  oCol:nColorBoxPen, oCol:nBoxPen ) //BYTE-ONE
            elseif ::nBoxPen > 0        //Box for all cells //BYTE-ONE
                oCol:Box( nRow, nil, nDataHeight, 4,  ::nColorBoxPen, ::nBoxPen )  //BYTE-ONE
        endif   //BYTE-ONE
    endif   //BYTE-ONE
   endif

   ::ReleaseDC()

return nil
 

Then in method box()() add lines with BYTE-ONE in text
Code: Select all  Expand view
METHOD Box( nRow, nCol, nHeight, nType, nColor, nPen ) CLASS TXBrwColumn    //BYTE-ONE
   local nKorr, hPen, hBrush    //BYTE-ONE
...
   case nType == 3 // Raise
      WndBoxRaised( hDC, nRow, nCol, nRow + nHeight - 1, nCol + nWidth - 1 )
   case nType == 4 // Box around the cell       //BYTE-ONE
    nKorr := if(nPen%2==0,nPen/2,(nPen-1)/2)    //BYTE-ONE
    hPen := CreatePen( PS_SOLID, nPen, nColor ) //BYTE-ONE
    hBrush := getstockobject(5)         //BYTE-ONE
    selectobject(hDC,hBrush)            //BYTE-ONE
    Rectangle( hDC, nRow + nKorr , nCol + nKorr, nRow + nHeight - nKorr  , nCol + nWidth - nKorr + 1 , hPen ) //BYTE-ONE
        DeleteObject( hPen )                //BYTE-ONE
   endcase

   ::oBrw:ReleaseDC()

return nil
 
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: New useful addition to xBrowse

Postby nageswaragunupudi » Tue Mar 01, 2016 3:34 pm

Many of my clients said, that the active cell for edit not so clearly visible (depending from MARQSTYLE).

I am sure you know already but it is worth repetition.

In case of Browses with inline edit, it is essential that the user always clearly sees which cell has the focus (i.e, the cell that is ready for edit) and after editing that cell which cell got focus for editing.

It may also be noted that XBrowse allows FastEdit only when the Cell under focus is visible to the user. However, this assumes that the programmer has judiciously used the colors.

By default, the following Marquee styles highlight the cell under focus and are recommended for inline edit of cells:
Code: Select all  Expand view
#define MARQSTYLE_DOTEDCELL   1
#define MARQSTYLE_SOLIDCELL   2
#define MARQSTYLE_HIGHLCELL   3
#define MARQSTYLE_HIGHLROWRC  4
 

For example, MARQSTYLE_SOLIDCELL with light gray lines provides a user with familiar and intuitive interface for inline edit, because it gives a familiar look of Excel. MARQSTYLE_HIGHLCELL also provides similar look with additional advantage of color.

Other styles from MARQSTYLE_HIGHLROW and above highlight the entire row and user gets no idea of the active cell. These marquee styles are useful for picklists, or views where the user is mainly concerned with the contents of the entire row and information as to the active cell is totally irrelevant to the user.

If we use the right Marquee Style for the appropriate purpose.

If for some reasons we like to high-light the entire row and at the same time provide inline editing and good visibility of the active cell to the user then the best option is to use oBrw:bClrRowFocus. In this case, entire row is painted with bClrRowFocus and the active cell is painted with bClrSelFocus. This has the advantage of displaying the row-wise color bar and also provide visibility of active cell the customer. FastEdit works even with these MarqueeStyles if used in conjunction with bClrRowFocus. How visible is the active cell to the user again depends on the choice of colors. Best examples of this approach are (1) XBROWSER and (2) samples in fwh\samples\testxbr3.prg.

Now coming to the issue of enclosing the active cell in a rectangle, we can straight away use MARQSTYLE_SOLIDCELL or MARQSTYLE_HIGHLROWRC. From 16.02 onwards we can also choose the color or pen to draw the box around the cell.

You have also raised the point to provide a visible clue to the user of which cell is active and editable and which is not editable. We can achieve this by
(1) suitable choice of color in bClrSelFocus
and
(2) Use a codeblock for oBrw:nColorBox choosing appropriate color of the box
Regards

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

Re: New useful addition to xBrowse

Postby byte-one » Tue Mar 01, 2016 3:52 pm

Many thanks for your excellent statement! I will use oBrw:nColorBox.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 51 guests