Page 1 of 1

Xbrowse Error

PostPosted: Wed Mar 30, 2022 9:29 pm
by mauri.menabue
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: Select all  Expand view

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
 

Re: Xbrowse Error

PostPosted: Thu Mar 31, 2022 12:34 pm
by nageswaragunupudi
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: Select all  Expand view
#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.

Image

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

Re: Xbrowse Error

PostPosted: Thu Mar 31, 2022 5:03 pm
by mauri.menabue
Hi, Nages
Try this

Code: Select all  Expand view

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

Re: Xbrowse Error

PostPosted: Thu Mar 31, 2022 5:07 pm
by nageswaragunupudi
Thanks for the clue.
We will work on it.

Re: Xbrowse Error

PostPosted: Fri Apr 01, 2022 5:07 am
by nageswaragunupudi
Please replace the existing METHOD CheckSize() with this new method and try:
Code: Select all  Expand view
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

Re: Xbrowse Error

PostPosted: Fri Apr 01, 2022 4:58 pm
by mauri.menabue
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 > 0
::nHeaderHeight -= ::nHeaderPad
endif
if ::nFooterPad > 0
::nFooterHeight -= ::nFooterPad
endif
::nHeaderPad := ::nFooterPad := 0

For me is better

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

TIA
Maurizio Menabue

Re: Xbrowse Error

PostPosted: Fri Apr 01, 2022 5:18 pm
by nageswaragunupudi
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

Re: Xbrowse Error

PostPosted: Sat Apr 02, 2022 3:56 am
by nageswaragunupudi
The next piece of code must always be executed, not only :
if ::lAdjusted is .T.

No please.
Please retain my code as it is.

Re: Xbrowse Error

PostPosted: Mon Apr 04, 2022 9:31 am
by mauri.menabue
Hi, Nages

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

Image

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

TIA

Re: Xbrowse Error

PostPosted: Mon Apr 04, 2022 12:02 pm
by nageswaragunupudi
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: Select all  Expand view
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?

Re: Xbrowse Error

PostPosted: Mon Apr 04, 2022 3:24 pm
by mauri.menabue
Hi, Nages
Yes it is
TIA

Re: Xbrowse Error

PostPosted: Wed Apr 06, 2022 8:37 am
by Silvio.Falconi
Nages,
with big archive not run ok

Re: Xbrowse Error

PostPosted: Sat Apr 09, 2022 2:54 pm
by nageswaragunupudi
Silvio.Falconi wrote:Nages,
with big archive not run ok


100,000 records DBF

Image

Re: Xbrowse Error

PostPosted: Sat Apr 09, 2022 3:22 pm
by Silvio.Falconi
nageswaragunupudi wrote:
Silvio.Falconi wrote:Nages,
with big archive not run ok


100,000 records DBF

Image


try with the dbfs I sent you this morning