FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse Error
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Xbrowse Error
Posted: Wed Mar 30, 2022 09:29 PM
hi all
Pressing the CTRL key and rotating the mouse wheel displays this error :

Application
===========
Path and name: D:\Biella\Soci.exe (32 bits)
Size: 6,222,848 bytes
Compiler version: Harbour 3.2.0dev (r2103311837)
FiveWin version: FWH 21.11
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 11 secs
Error occurred at: 30-03-2022, 18:06:35
Error description: Error BASE/1082 Parametro errato: -
Args:
[ 1] = U
[ 2] = N 4.00000

Stack Calls
===========
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CHECKSIZE( 1388 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 2228 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 2168 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1821 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12005 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3560 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 448 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 24 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CHECKSIZE( 1388 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:ADJUST( 1495 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RECALCWH( 9595 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:FONTSIZE( 9573 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:MOUSEWHEEL( 5488 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1855 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 12005 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3560 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 1097 )
Called from: prog\Main.prg => MAIN( 660 )

System
======
CPU type: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz 2592 Mhz
Hardware memory: 16221 megs

Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %

Windows total applications running: 5 ...



Code (fw): Select all Collapse
METHOD CheckSize()  CLASS TXBrowse

   local aRect
   local nGap

   if ( ::nRightMargin != nil .or. ::nBottomMargin != nil ) .and. !( ::oWnd:oClient == Self )
      aRect    := GetClientRect( ::oWnd:hWnd )
      if ::nRightMargin != nil
         ::nWidth       := aRect[ 4 ] - ::nRightMargin - ::nLeft
      endif
      if ::nBottomMargin != nil
         ::nHeight      := aRect[ 3 ] - ::nBottomMargin - ::nTop
      endif

   endif

   if ::nHeaderPad > 0
      IF .not. ::nHeaderHeight == NIL    <------------------------ New Line of code to work around the error
         ::nHeaderHeight   -= ::nHeaderPad
      ENDIF
   endif
   
   if ::nFooterPad > 0
      IF .not. ::nFooterHeight == NIL  <------------------------  New Line of code to work around the error
         ::nFooterHeight   -= ::nFooterPad
      ENDIF
   endif
   
   ::nHeaderPad := ::nFooterPad := 0

   if ::lAdjusted .and. ::lFitGridHeight .and. ;
      ( ( ::lHeader .and. ::nHeaderHeight > 1 ) .or. ::lFooter )

      if ( nGap  := ::DataRect:nHeight % ::nRowHeight ) > 0

         if ::lHeader .and. ::nHeaderHeight > 1
            if ::lFooter
               ::nFooterPad   := Int( nGap * ::nFooterHeight / ( ::nHeaderHeight + ::nFooterHeight ) )
               ::nHeaderPad   := nGap - ::nFooterPad

//               ::nFooterHeight   += ::nHeaderPad // bug fixed 2018-07-10
//               ::nHeaderHeight   += ::nFooterPad

               ::nFooterHeight   += ::nFooterPad   // bug fixed 2018-07-10
               ::nHeaderHeight   += ::nHeaderPad

            else
               ::nHeaderHeight   += ( ::nHeaderPad := nGap )
            endif
         else
            ::nFooterHeight   += ( ::nFooterPad := nGap )
         endif
      endif

   endif


return Self
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Thu Mar 31, 2022 12:34 PM
Scrolling mouse wheel while pressing Ctrl-Key is used to Zoom and Unzoom xbrowse.
We are looking into the problem reported by you.
For this purpose, we are trying to recreate the problem at our end but unable to recreate this error here.
This is the test program:
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg, oFont, oBrw

   USE CUSTOMER

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "Ctrl + MouseWheel Scroll to ZOOM/UNZOOM"

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE ALIAS() AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

When we scroll mouse wheel pressing Ctrl key, we are getting zoom/unzoom effect as expected but no errors.



Can you please modify the above program to produce the error to enable us to fix it please?
Regards



G. N. Rao.

Hyderabad, India
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Re: Xbrowse Error
Posted: Thu Mar 31, 2022 05:03 PM
Hi, Nages
Try this

Code (fw): Select all Collapse
function Main()

   local oDlg, oFont, oBrw

   USE CUSTOMER

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "Ctrl + MouseWheel Scroll to ZOOM/UNZOOM"

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE ALIAS() AUTOCOLS ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
       :lFitGridHeight := .T.  // <===================== ADD THIS LINE
       :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil


TIA
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Thu Mar 31, 2022 05:07 PM

Thanks for the clue.
We will work on it.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Fri Apr 01, 2022 05:07 AM
Please replace the existing METHOD CheckSize() with this new method and try:
Code (fw): Select all Collapse
METHOD CheckSize()  CLASS TXBrowse

   local aRect
   local nGap

   if ( ::nRightMargin != nil .or. ::nBottomMargin != nil ) .and. !( ::oWnd:oClient == Self )
      aRect    := GetClientRect( ::oWnd:hWnd )
      if ::nRightMargin != nil
         ::nWidth       := aRect[ 4 ] - ::nRightMargin - ::nLeft
      endif
      if ::nBottomMargin != nil
         ::nHeight      := aRect[ 3 ] - ::nBottomMargin - ::nTop
      endif

   endif

   if ::lAdjusted
      if ::nHeaderPad > 0
         ::nHeaderHeight   -= ::nHeaderPad
      endif
      if ::nFooterPad > 0
         ::nFooterHeight   -= ::nFooterPad
      endif
      ::nHeaderPad := ::nFooterPad := 0

      if ::lFitGridHeight .and. ;
         ( ( ::lHeader .and. ::nHeaderHeight > 1 ) .or. ::lFooter )

         if ( nGap  := ::DataRect:nHeight % ::nRowHeight ) > 0

            if ::lHeader .and. ::nHeaderHeight > 1
               if ::lFooter
                  ::nFooterPad   := Int( nGap * ::nFooterHeight / ( ::nHeaderHeight + ::nFooterHeight ) )
                  ::nHeaderPad   := nGap - ::nFooterPad

//                ::nFooterHeight   += ::nHeaderPad // bug fixed 2018-07-10
//                ::nHeaderHeight   += ::nFooterPad

                  ::nFooterHeight   += ::nFooterPad   // bug fixed 2018-07-10
                  ::nHeaderHeight   += ::nHeaderPad

               else
                  ::nHeaderHeight   += ( ::nHeaderPad := nGap )
               endif
            else
               ::nFooterHeight   += ( ::nFooterPad := nGap )
            endif
         endif
      endif
   endif

return Self

Please try and let us know if the problem is completely solved.
Thanks for helping us to fix this bug
Regards



G. N. Rao.

Hyderabad, India
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Re: Xbrowse Error
Posted: Fri Apr 01, 2022 04:58 PM

hi, Nages

It's almost fine, but the height of the headboard in the
various zoom positions does not remain constant 1 or 2 or 3 row

The next piece of code must always be executed, not only :
if ::lAdjusted is .T.

  if ::nHeaderPad &gt; 0
     ::nHeaderHeight   -= ::nHeaderPad
  endif
  if ::nFooterPad &gt; 0
     ::nFooterHeight   -= ::nFooterPad
  endif
  ::nHeaderPad := ::nFooterPad := 0

For me is better

  if ::nHeaderPad &gt; 0
     if .not. :: ::nHeaderHeight  == NIL
        ::nHeaderHeight   -= ::nHeaderPad
     endif
  endif
  if ::nFooterPad &gt; 0
      if .not. ::nFooterHeight  == NIL
         ::nFooterHeight   -= ::nFooterPad
      endif
  endif
  ::nHeaderPad := ::nFooterPad := 0

TIA
Maurizio Menabue

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Fri Apr 01, 2022 05:18 PM

Both headerheight and footer height keep changing because of change in font size and also trying to keep the browselines snugly fit to the height also effects header and footer heights. that is ok

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Sat Apr 02, 2022 03:56 AM
The next piece of code must always be executed, not only :
if ::lAdjusted is .T.

No please.
Please retain my code as it is.
Regards



G. N. Rao.

Hyderabad, India
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Re: Xbrowse Error
Posted: Mon Apr 04, 2022 09:31 AM
Hi, Nages

I don't want to be boring but that's what I meant to say about resizing column headers.



I would never allow myself to teach you, you are the teacher!

TIA
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Mon Apr 04, 2022 12:02 PM
I don't want to be boring


No, you are not boring at all.
Actually, you are spending your precious time by making all efforts to point out mistakes and that is a great help to us. Thank you.
I was expecting this kind of posting from you when you were asking in the other thread about how to post screen-shots.

I would never allow myself to teach you, you are the teacher!


Please never say that.
In fact, all these years, I have learnt a lot from friends like you here and I am still learning.

Coming back to the topic, do you mean to say that this code :

Code (fw): Select all Collapse
if ::nHeaderPad > 0
if .not. :: ::nHeaderHeight == NIL
::nHeaderHeight -= ::nHeaderPad
endif
endif
if ::nFooterPad > 0
if .not. ::nFooterHeight == NIL
::nFooterHeight -= ::nFooterPad
endif
endif
::nHeaderPad := ::nFooterPad := 0


will solve this issue?
Regards



G. N. Rao.

Hyderabad, India
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Re: Xbrowse Error
Posted: Mon Apr 04, 2022 03:24 PM

Hi, Nages
Yes it is
TIA

Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Xbrowse Error
Posted: Wed Apr 06, 2022 08:37 AM

Nages,
with big archive not run ok

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse Error
Posted: Sat Apr 09, 2022 02:54 PM
Silvio.Falconi wrote:Nages,
with big archive not run ok


100,000 records DBF

Regards



G. N. Rao.

Hyderabad, India
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM
Re: Xbrowse Error
Posted: Sat Apr 09, 2022 03:22 PM
nageswaragunupudi wrote:
Silvio.Falconi wrote:Nages,
with big archive not run ok


100,000 records DBF



try with the dbfs I sent you this morning
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion