resize a column to multiline in xbrowse

Re: resize a column to multiline in xbrowse

Postby hua » Tue Mar 10, 2015 1:38 am

Rao,

aRect now has an array of coordinates but nMaxHeight is not adequate to show more than 1 line

Code: Select all  Expand view
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchase transactions which disregarded under GST legislation (e.g. purchase within GST group registration)]   aRect = {22,0,335,684}                                      
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Imports under special scheme with no GST incurred (e.g. Approved Trader Scheme, ATMS Scheme).]  aRect = {22,0,335,684}                                                      
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchase from non GST-registered supplier with no GST incurred.]  aRect = {22,0,335,684}                                                                                    
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchase transactions which is out of the scope of GST legislation (e.g. purchase of goods overseas).]   aRect = {22,0,335,684}                                            
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchase from GST-registered supplier with no GST incurred. (e.g. supplier provides transportation of goods that qualify as international services).] aRect = {22,0,335,684}
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Any adjustment made to Input Tax e.g.: Bad Debt Relief & other input tax adjustment.]  aRect = {22,0,335,684}                                                              
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchases with GST incurred but not claimable (Disallowance of Input Tax) (e.g. medical expenses for staff).]  aRect = {22,0,335,684}                                      
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [GST incurred for import of goods.]  aRect = {22,0,335,684}                                                                                                                  
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchases with GST incurred at 6% and directly attributable to taxable supplies.]   aRect = {22,0,335,684}                                                                  
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [GST incurred directly attributable to incidental exempt supplies.]   aRect = {22,0,335,684}                                                                                
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [GST incurred directly attributable to non-incidental exempt supplies.]  aRect = {22,0,335,684}                                                                              
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [GST incurred that is not directly attributable to taxable or exempt supplies.]   aRect = {22,0,335,684}                                                                    
XBRCOLMAXHEIGHT( 843 )  hDC = 1426134517  cData = [Purchases exempted from GST. E.g. purchase of residential property or financial services.]   aRect = {22,0,335,684}                                                        
 


Image

Thank you
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Re: resize a column to multiline in xbrowse

Postby nageswaragunupudi » Tue Mar 10, 2015 5:39 am

Can you please add another line of code to log the result of nMaxHeight after calling the drawtestex(...)
Regards

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

Re: resize a column to multiline in xbrowse

Postby hua » Tue Mar 10, 2015 7:28 am

Here you go Rao,

Code: Select all  Expand view
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchase transactions which disregarded under GST legislation (e.g. purchase within GST group registration)]   aRect = {22,0,335,684}  nMaxHeight = 30                                      
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Imports under special scheme with no GST incurred (e.g. Approved Trader Scheme, ATMS Scheme).]  aRect = {22,0,335,684}  nMaxHeight = 30                                                      
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchase from non GST-registered supplier with no GST incurred.]  aRect = {22,0,335,684}  nMaxHeight = 30                                                                                    
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchase transactions which is out of the scope of GST legislation (e.g. purchase of goods overseas).]   aRect = {22,0,335,684}  nMaxHeight = 30                                            
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchase from GST-registered supplier with no GST incurred. (e.g. supplier provides transportation of goods that qualify as international services).] aRect = {22,0,335,684}  nMaxHeight = 30
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Any adjustment made to Input Tax e.g.: Bad Debt Relief & other input tax adjustment.]  aRect = {22,0,335,684}  nMaxHeight = 30                                                              
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchases with GST incurred but not claimable (Disallowance of Input Tax) (e.g. medical expenses for staff).]  aRect = {22,0,335,684}  nMaxHeight = 30                                      
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [GST incurred for import of goods.]  aRect = {22,0,335,684}  nMaxHeight = 30                                                                                                                  
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchases with GST incurred at 6% and directly attributable to taxable supplies.]   aRect = {22,0,335,684}  nMaxHeight = 30                                                                  
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [GST incurred directly attributable to incidental exempt supplies.]   aRect = {22,0,335,684}  nMaxHeight = 30                                                                                
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [GST incurred directly attributable to non-incidental exempt supplies.]  aRect = {22,0,335,684}  nMaxHeight = 30                                                                              
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [GST incurred that is not directly attributable to taxable or exempt supplies.]   aRect = {22,0,335,684}  nMaxHeight = 30                                                                    
XBRCOLMAXHEIGHT( 845 )  hDC = 1224811279  cData = [Purchases exempted from GST. E.g. purchase of residential property or financial services.]   aRect = {22,0,335,684}  nMaxHeight = 30                                                        
 


Not sure whether the font assigned to xBrowse is relevant to this issue but if it is here is the font object:
Code: Select all  Expand view
FUNC UD_MFont()

     LOCAL oFont

     LOCAL nWidth,                   ;
           nHeight,                  ;
           lFromUser,                ;
           lBold,                    ;
           nEscapement,              ;
           nOrientation,             ;
           nWeight,                  ;
           lItalic,                  ;
           lUnderline,               ;
           lStrikeOut,               ;
           nCharSet,                 ;
           nOutPrecision,            ;
           nClipPrecision,           ;
           nQuality,                 ;
           oDevice

     cFaceName      := "SYSTEM_FIXED_FONT" //"COURIER NEW"
     nWidth         := 0
     nHeight        := -10
     lFromUser      := FALSE
     lBold          := TRUE
     nEscapement    := 0
     nOrientation   := 0
     nWeight        := 500
     lItalic        := FALSE
     lUnderline     := FALSE
     lStrikeOut     := FALSE
     nCharSet       := 1
     nOutPrecision  := 3
     nClipPrecision := 2
     nQuality       := 0


     oFont := TFONT():NEW( cFaceName,      ;
                           nWidth,         ;
                           nHeight,        ;
                           lFromUser,      ;
                           lBold,          ;
                           nEscapement,    ;
                           nOrientation,   ;
                           nWeight,        ;
                           lItalic,        ;
                           lUnderline,     ;
                           lStrikeOut,     ;
                           nCharSet,       ;
                           nOutPrecision,  ;
                           nClipPrecision, ;
                           nQuality        ;
                         )

RETURN oFont
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Re: resize a column to multiline in xbrowse

Postby nageswaragunupudi » Tue Mar 10, 2015 7:47 am

I need to see the full code.
Regards

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

Re: resize a column to multiline in xbrowse

Postby hua » Tue Mar 10, 2015 7:53 am

Ok Rao. I'll try to build a self contained example.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Re: resize a column to multiline in xbrowse

Postby hua » Thu Mar 12, 2015 9:41 am

Rao, here is the self-contained example

PRG
Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"

#define DT_WORDBREAK                0x00000010
#define DT_CALCRECT                 0x00000400

function main()
  local oMFont1 := UD_MFont(), oBrw, oDlg, aBrwData, nCnt1, bInit

  CreateDbf()

  use taxcode new exclusive
  aBrwData := {                            ;
                { "taxcode", " Code "       },   ;
                { "perc"   , " Tax Rate"    },   ;
                { "desc"   , " Description" }    ;
              }

  DEFINE DIALOG oDlg RESOURCE "xHelp" TITLE "Select" FONT oMFont1

  REDEFINE COLUMN XBROWSE oBrw ID 13 OF oDlg                ;
    COLOR CLR_BLACK, CLR_YELLOW                             ;
    FONT oMFont1 LINES

    with object oBrw
         :l2007 := .f.
         :lRecordSelector := .f.
         :nMarqueeStyle  := MARQSTYLE_HIGHLROW
         :bClrHeader     := { ||  { CLR_YELLOW, CLR_BLUE } }
         :bClrSelFocus   := { || { CLR_WHITE, CLR_CYAN  } }
         :lAllowColSwapping   := .f.
         :lAllowColHiding     := .f.
    end

  oBrw:blDblClick   := { || oDlg:End() }
  oBrw:lHScroll     := .t.
  oBrw:nStretchCol  := STRETCHCOL_WIDEST //2
  oBrw:bKeyDown     := { | nKey | IF( GetKeyState( VK_RETURN ),                 ;
                                        (                                      ;
                                           oDlg:End()                          ;
                                        ),                                     ;
                                        nil                                    ;
                                    ) }


FOR nCnt1 := 1 TO LEN( aBrwData )
    ADD COLUMN TO oBrw                                   ;
        DATA   &( "{||" + aBrwData[ nCnt1, 1 ] + "}" )   ;
        HEADER aBrwData[ nCnt1, 2 ]
NEXT

oBrw:nFreeze := nCnt1 - 1

bInit := <||
             oBrw:aCols[3]:cDataType := "M"
             oBrw:nRowHeight := XbrColMaxHeight( oBrw:aCols[3] )
             oBrw:SetFocus()
         >

ACTIVATE DIALOG oDlg CENTERED                       ;
   ON INIT eval(bInit)

oMFont1 :End()

return nil
//----------------------------------------------------------------------
function CreateDbf()
  local aCodes := {   ;
                     {"TX    ","6%","Purchases with GST incurred at 6% and directly attributable to taxable supplies."}, ;
                     {"IM    ","6%","GST incurred for import of goods."}, ;
                     {"IS    ","0%","Imports under special scheme with no GST incurred (e.g. Approved Trader Scheme, ATMS Scheme)."}, ;
                     {"BL    ","6%","Purchases with GST incurred but not claimable (Disallowance of Input Tax) (e.g. medical expenses for staff)."}, ;
                     {"NR    ","0%","Purchase from non GST-registered supplier with no GST incurred."}, ;
                     {"ZP    ","0%","Purchase from GST-registered supplier with no GST incurred. (e.g. supplier provides transportation of goods that qualify as international services)."}, ;
                     {"EP    ","0%","Purchases exempted from GST. E.g. purchase of residential property or financial services."}, ;
                     {"OP    ","0%","Purchase transactions which is out of the scope of GST legislation (e.g. purchase of goods overseas)."}, ;
                     {"TX-E43","6%","GST incurred directly attributable to incidental exempt supplies."}, ;
                     {"TX-N43","6%","GST incurred directly attributable to non-incidental exempt supplies."}, ;
                     {"TX-RE ","6%","GST incurred that is not directly attributable to taxable or exempt supplies."}, ;
                     {"GP    ","0%","Purchase transactions which disregarded under GST legislation (e.g. purchase within GST group registration)"}, ;
                     {"AJP   ","6%","Any adjustment made to Input Tax e.g.: Bad Debt Relief & other input tax adjustment."} ;
                  }
  local aRec

  if !file("taxcode.dbf")
     dbCreate("taxcode", { {"taxcode", "c", 6, 0}, ;
                           {"perc"   , "c", 2, 0}, ;
                           {"desc"   , "m",10, 0}  ;
                         })

     use taxcode new exclusive
     for each aRec in aCodes
         append blank
         field->taxcode := aRec[1]
         field->perc    := aRec[2]
         field->desc    := aRec[3]
     next
     use
  endif
return nil
//----------------------------------------------------------------------
function XbrColMaxHeight( oCol )

   local oBrw, hDC
   local nLeft, nHeight, nRight, nWidth
   local cData, oFont, aRect
   local uSave, nMaxHeight, nCurrentHeight

   oBrw              := oCol:oBrw
   nMaxHeight        := 0
   nLeft             := oCol:nDisplayCol
   nRight            := Min( nLeft + oCol:nWidth, oBrw:BrwWidth() - 5 )
   if nRight - nLeft < 10
      return oBrw:nRowHeight
   endif

   hDC               := oBrw:GetDC()
   oFont             := If( ValType( oCol:oDataFont ) == 'B', Eval( oCol:oDataFont ), oCol:oDataFont )
   oFont:Activate( hDC )
   aRect             := oBrw:DataRect():aRect
   aRect[ 2 ]        := nLeft
   aRect[ 4 ]        := nRight
   uSave             := oBrw:BookMark
   oBrw:GoTop()

   REPEAT

      cData          := Trim( cValToChar( Eval( oCol:bStrData ) ) )
      if ! Empty( cData )
         nCurrentHeight := DrawTextEx( hDC, cData, aRect, nOr( DT_CALCRECT, DT_WORDBREAK ) )
         nMaxHeight  := Max( nCurrentHeight, nMaxHeight )
         *FWLOG hDC, cData, aRect, nMaxHeight
      endif
      // not handling bitmap width, indent, if any.

   UNTIL oBrw:Skip( 1 ) != 1

   oBrw:BookMark     := uSave
return nMaxHeight
//----------------------------------------------------------------------
FUNC UD_MFont()

     LOCAL oFont

     LOCAL nWidth,                   ;
           nHeight,                  ;
           lFromUser,                ;
           lBold,                    ;
           nEscapement,              ;
           nOrientation,             ;
           nWeight,                  ;
           lItalic,                  ;
           lUnderline,               ;
           lStrikeOut,               ;
           nCharSet,                 ;
           nOutPrecision,            ;
           nClipPrecision,           ;
           nQuality,                 ;
           oDevice

     local cFaceName      := "SYSTEM_FIXED_FONT"
     nWidth         := 0
     nHeight        := -10
     lFromUser      := .f.
     lBold          := .t.
     nEscapement    := 0
     nOrientation   := 0
     nWeight        := 500
     lItalic        := .f.
     lUnderline     := .f.
     lStrikeOut     := .f.
     nCharSet       := 1
     nOutPrecision  := 3
     nClipPrecision := 2
     nQuality       := 0


     oFont := TFONT():NEW( cFaceName,      ;
                           nWidth,         ;
                           nHeight,        ;
                           lFromUser,      ;
                           lBold,          ;
                           nEscapement,    ;
                           nOrientation,   ;
                           nWeight,        ;
                           lItalic,        ;
                           lUnderline,     ;
                           lStrikeOut,     ;
                           nCharSet,       ;
                           nOutPrecision,  ;
                           nClipPrecision, ;
                           nQuality        ;
                         )

RETURN oFont
 


RC
Code: Select all  Expand view
xHELP DIALOG 26, 43, 498, 265
EXSTYLE WS_EX_DLGMODALFRAME
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU
FONT 10, "System"
{
 CONTROL "", 13, "txbrowse", WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP, 12, 36, 420, 176
 CONTROL "", 401, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP, 13, 10, 225, 9
}
 
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Re: resize a column to multiline in xbrowse

Postby hua » Tue Mar 17, 2015 3:06 am

Any solution Rao?
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Re: resize a column to multiline in xbrowse

Postby nageswaragunupudi » Tue Mar 17, 2015 5:04 am

I could not look into this due to other preoccupations. I shall get back to you soon.
Regards

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

Re: resize a column to multiline in xbrowse

Postby hua » Tue Mar 17, 2015 6:55 am

Ok. No problem Rao :D
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1062
Joined: Fri Oct 28, 2005 2:27 am

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

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