FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Some useful modifications to XBROWSE
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Some useful modifications to XBROWSE
Posted: Tue Feb 16, 2016 01:53 PM
All changed lines are marked with BYTE-ONE

In CLASS TXBrwColumn

1. Remove PROTECTED to use this data
Code (fw): Select all Collapse
DATA nColDividerWidth //PROTECTED // not yet implemented. //BYTE-ONE

2. Following changes to make listboxes widther as the xBrowse-column and a empty(::aEditListTxt) not make a runtime-error and the height of the listbox follows the fontsize
Code (fw): Select all Collapse
DATA nLbxWidth INIT 0   //Width from Listbox //BYTE-ONE

Code (fw): Select all Collapse
METHOD ShowBtnList( nKey ) CLASS TXBrwColumn

   local aBound
   local xValue
   local hBrush
   local nAt, nRow, nCol, nWidth, nHeight, aColors, oFont
   local lWhen    := ( ::bEditWhen == nil .or. Eval( ::bEditWhen, Self ) )

   if ::aEditListTxt == nil .or. (valtype(::aEditListTxt)=="A" .and. len(::aEditListTxt)==0)    //BYTE-ONE
      MsgStop( "oCol:aEditListTxt not defined or oCol:aEditListTxt has len 0", "Fivewin: Class TXBrwColumn" )   //BYTE-ONE
      return .f.
   endif

   if ::bOnPostEdit == nil
      MsgStop( "oCol:bOnPostEdit not defined",;
               "Fivewin: Class TXBrwColumn" )
      return .f.
   endif

   ::oBrw:nColSel := ::nPos

   if ValType( ::aEditListTxt[ 1 ] ) == 'A'
      ::aEditListBound  := ArrTranspose( ::aEditListTxt )[ 1 ]
      ::aEditListTxt    := ArrTranspose( ::aEditListTxt )[ 2 ]
   endif

   aBound   := IfNil( ::aEditListBound, AClone( ::aEditListTxt ) )
   if ValType( xValue := ::Value ) == 'C'
      xValue   := Trim( xValue )
   endif
   if ( nAt := Ascan( aBound, xValue ) ) == 0
      if ValType( xValue ) == 'C'
         do while Len( xValue ) > 1 .and. nAt == 0
            xValue      := Left( xValue, Len( xValue ) - 1 )
            nAt         := AScan( aBound, xValue )
         enddo
      elseif ( nAt := AScan( aBound, { |u| xValue <= u } ) ) == 0
         nAt   := Len( aBound )
      endif
   endif
   xValue   := nil

   nRow     := ( ::oBrw:nRowSel * ::oBrw:nRowHeight ) + ::oBrw:HeaderHeight() - 1
//   nCol     := ::nDisplayCol - 2
   nWidth   := max(::nWidth + 3,::nLbxWidth) //BYTE-ONE
//   nCol     := if( ::nDisplayCol - 2 + nWidth > ::BrwWidth() , ::nDisplayCol +  2 + ::BrwWidth() - nWidth,::nDisplayCol - 2 )   //BYTE-ONE
   nCol     := if( ::nDisplayCol - 2 + nWidth > ::oBrw:BrwWidth() , ::oBrw:BrwWidth() - nWidth,::nDisplayCol - 2 )  //BYTE-ONE
//   nHeight  := Len( ::aEditListTxt ) * ( FontHeight( ::oBrw, ::oFont ) ) + 2
   nHeight  := Len( ::aEditListTxt ) * ( FontHeight( ::oBrw, if(::oEditFont == NIL ,::oBrw:oFont,If( ValType( ::oEditFont ) == 'B', Eval( ::oEditFont ), ::oEditFont )) ) ) + 2 //BYTE-ONE

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Some useful modifications to XBROWSE
Posted: Tue Feb 16, 2016 08:44 PM

Günther,

Many thanks

We are going to review it asap

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Some useful modifications to XBROWSE
Posted: Sun Feb 21, 2016 09:41 AM

Mr. Rao, have you also seen this wish and/or suggestions? Thanks!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Some useful modifications to XBROWSE
Posted: Sun Feb 21, 2016 09:45 AM

Yes and we are going to provide programmer configurable width for listboxes.

We may not be able to make nColDividerWidth available immediately as this requires a lot more work and changes.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Some useful modifications to XBROWSE
Posted: Mon Feb 22, 2016 05:20 AM

Mr Günther

I am reviewing this issue. I think there is no need for the width of the listbox to be wider than the column width (except for variation due to fonts). I can be wrong. Can you please convince me that I am wrong?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Some useful modifications to XBROWSE
Posted: Mon Feb 22, 2016 09:05 AM

Mr. Rao, i use this to show full text (for clearness) in many cases. To save is in most cases only the bounded Text. Also can the full text show in the column with 2 or more lines!

Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Some useful modifications to XBROWSE
Posted: Fri Feb 26, 2016 01:16 PM
Mr Günther

I modified to set width of list-box to fit width of the widest item in the prompts or the column width, whichever is higher.

Present code from lines 12021 of xbrowse.prg ( 16.01 ) is
Code (fw): Select all Collapse
   nRow     := ( ::oBrw:nRowSel * ::oBrw:nRowHeight ) + ::oBrw:HeaderHeight() - 1
   nCol     := ::nDisplayCol - 2
   nWidth   := ::nWidth + 3
   nHeight  := Len( ::aEditListTxt ) * If( lTouch, DeviceTouchSpace(), FontHeight( ::oBrw, ::oBrw:oFont ) ) + 2

This is the revised code
Code (fw): Select all Collapse
   oFont    := ::EditFont
   nRow     := ( ::oBrw:nRowSel * ::oBrw:nRowHeight ) + ::oBrw:HeaderHeight() - 1
   nCol     := ::nDisplayCol - 2
   nWidth   := ::nWidth + 3
   nWidth   := Max( nWidth, CalcTextWH( ::oBrw, FW_ArrayAsList( ::aEditListTxt, CRLF ), oFont )[ 1 ] + COL_EXTRAWIDTH + ;
                            IfNil( ::nBtnWidth, 10 ) + 5 )
   nCol     := Max( 1, Min( nCol, ::oBrw:BrwWidth() - nWidth -2 ) )
   nHeight  := Len( ::aEditListTxt ) * If( lTouch, DeviceTouchSpace(), FontHeight( ::oBrw, oFont ) ) + 2

Any comments please?
Regards



G. N. Rao.

Hyderabad, India
Posts: 1048
Joined: Mon Oct 24, 2005 09:54 AM
Re: Some useful modifications to XBROWSE
Posted: Fri Feb 26, 2016 05:36 PM
Mr. Rao
all is in my opinion. Thanks!

1. One point is additional to respect: If the right end of the listbox reaches over the end from browse, the list should be moved to left for this overhang!

Oh, i see this is respected!! :-)
2. A ::aEditListTxt-array with len == 0 make a runtime-error!

Tomorrow i will test and report.
Regards,
Günther
---------------------------------
office@byte-one.com
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Some useful modifications to XBROWSE
Posted: Fri Feb 26, 2016 10:43 PM

I hope the areas of concern previously expressed are addressed with xBrowse. If not, these changes may simply increase the problems. I have some very very angry customers because of the column spacing problems in the current builds and had to revert back, but that required additional re-coding because the new ones required me to make changes that then had to be commented out.

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Some useful modifications to XBROWSE
Posted: Sat Feb 27, 2016 01:19 AM
2. A ::aEditListTxt-array with len == 0 make a runtime-error!

This is taken care of by testing for
Code (fw): Select all Collapse
   if Empty( ::aEditListTxt )

instead of
Code (fw): Select all Collapse
if ::aEditListTxt == nil

This was also implemented already.

column spacing problems

We are carefully looking into all these issues also.
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion