FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Comments and requests about TWBrowse
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Wed Sep 19, 2012 11:02 AM

Yes Dear Friend.
Perhaps even refer to the application itself!
Is it possible?

Marco

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 20, 2012 02:32 PM
Saving and restoring the bitmap is painting the saved image one pixel off from the original position. This can be fixed

Excuse me but this small problem has been resolved?
Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Sat Sep 22, 2012 06:59 PM

Marco,

If you are using a shared DBF and if another user changes a record, you will not see his changes using this technique

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Sat Sep 22, 2012 07:12 PM

Antonio,
I know.
The solution of nage is very very good in my opinion.
A Bitmap instead of rows
There is a little shit from bmp image and real image
There are some programs for indivual use and that operate in static tables
bye

Marco Boschi
info@marcoboschi.it
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Tue Sep 25, 2012 03:08 PM

I knew this and also I thought this could be fixed. If in principle, this is taking us in the right direction avoiding re-reading data from source atleast when repainting in non-focused state, then we can proceed further to improve this.

Saving and restoring the bitmap is painting the saved image one pixel off from the original position. This can be fixed.


Hi Nage,
excuse me for my insistence.
I don't understand if this little problem has to be fixed by you developers or directly by a "bravo" programmer (obviously not me)
Have a nice day
marco
Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Wed Sep 26, 2012 05:55 AM

Marco,

Try with different values from zero here:

DrawBitmap( ::hDC, ::hSaveScr, 1, 0 )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Wed Sep 26, 2012 06:55 AM

Antonio,
perhaps negative numbers?
Bye
marco

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 27, 2012 01:58 AM

Yes, try it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 27, 2012 06:53 AM

Antonio,
unfortunately does not work.
bye

:(

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 27, 2012 08:16 AM

Marco,

In FWH/source/winapi/bmpdraw.c DrawBitmap() is defined as:

void DrawBitmap( HDC hdc, HBITMAP hbm, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster )

please change it as:

void DrawBitmap( HDC hdc, HBITMAP hbm, int wCol, int wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster )

recompile it and link it as another OBJ of your app

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 27, 2012 11:48 AM

Antonio,
Now I am satisfied!
No more slowness in repainting 8)
And no more :wink: unnecessary network traffic

Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Thu Sep 27, 2012 11:59 AM

Marco,

Very good :-)

Please copy here your final code for wbrowse max speed, thanks :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Comments and requests about TWBrowse
Posted: Fri Sep 28, 2012 07:46 AM
Antonio,
when this application is in bacground if I move dialogs of other programs in the desktop
If a repaint is needed is faster.
It is obviuos that you have to try this code with a large table with open index, perhaps with many relations to appreciate the difference between a dialog with this device and not the "usual" customer.dbf in the local disk.
Is not only a a visual issue.
If you observe Activity Status Packets Send and receive on Local area network Status,
You can note that no packets pass through the network If this application is in Background state.

Many thanks to Nage for this solution and to other experts

King regards
marco



Code (fw): Select all Collapse
#include "fivewin.ch"

#xtranslate DelObj <o> => If <o> != nil; DeleteObject( <o> ); endif; <o> := nil

REQUEST HB_GT_GUI_DEFAULT

ANNOUNCE RDDSYS

STATIC oDlg

FUNCTION MAIN()

LOCAL oBrw
LOCAL oGet , cGet := "           "
LOCAL aRec := {}


LOCAL nIni
LOCAL nRig
LOCAL nFin
LOCAL nCur := 1

SET DELETED ON
SET EXCLUSIVE OFF
USE customer
SET INDEX TO customer

nRig := 20
nIni := 1
nFin := 1


   DEFINE DIALOG oDlg FROM 1 , 1 TO 600 , 800 PIXEL


   @ 1 , 1 GET oGet VAR cGet OF oDlg
   oBrw := TXBR3():new( 2 , 1 , 800 , 600 )
   oDlg:nStyle = NOR( oDlg:nStyle, WS_THICKFRAME, WS_MAXIMIZEBOX , WS_MINIMIZEBOX )
   oDlg:bResized = { || Ridim( oDlg, oBrw ) }

   ACTIVATE DIALOG oDlg ON INIT ridim( oDlg , obrw )


RETURN NIL

FUNCTION RIDIM( oDlg, oBrw )

   LOCAL aInfo := oDlg:DispBegin()
   oBrw:nWidth = oDlg:nWidth - 20
   oBrw:nHeight = oDlg:nHeight - 120
   oDlg:DispEnd( aInfo )
   oBrw:lForcepaint := .T.
   oBrw:Paint()

RETURN NIL



CLASS TXBR3 FROM TWBROWSE

   CLASSDATA lRegistered AS LOGICAL // used internally

   DATA  hSaveScr
   DATA  lForcePaint

   METHOD Paint()
   METHOD Destroy()

ENDCLASS

METHOD PAINT() CLASS TXBR3

    LOCAL aInfo
    IF ::lForcePaint
       DelObj ::hSaveScr
       Super:Paint()
       ::lForcePaint := .F.
    ELSE
       IF ::hSaveScr != nil .and. GetFocus() != ::hWnd
          aInfo := ::DispBegin()
          DrawBitmap( ::hDC, ::hSaveScr, -2, -2 )
          ::DispEnd( aInfo )
       ELSE
          Super:Paint()
          DelObj ::hSaveScr
          ::hSaveScr  := WndBitMap( ::hWnd )
       ENDIF
   ENDIF

return nil

METHOD Destroy() CLASS TXBR3

   DelObj ::hSaveScr

return Super:Destroy()



INIT PROCEDURE RddInit
REQUEST DBFFPT
REQUEST DBFCDX
rddSetDefault( "DBFCDX" )




#pragma BEGINDUMP

#include "windows.h"
#include "hbapi.h"


void DrawBitmap( HDC hdc, HBITMAP hbm, int wCol, int wRow, WORD wWidth,
                 WORD wHeight, DWORD dwRaster )
{
    HDC       hDcMem, hDcMemX;
    BITMAP    bm, bmx;
    HBITMAP   hBmpOld, hbmx, hBmpOldX;

    if( !hdc || !hbm )
       return;

    hDcMem  = CreateCompatibleDC( hdc );
    hBmpOld = ( HBITMAP ) SelectObject( hDcMem, hbm );

    if( ! dwRaster )
       dwRaster = SRCCOPY;

    GetObject( hbm, sizeof( BITMAP ), ( LPSTR ) &bm );

    if( ! wWidth || ! wHeight )
       BitBlt( hdc, wRow, wCol, bm.bmWidth, bm.bmHeight, hDcMem, 0, 0, dwRaster );
    else
    {
       hDcMemX          = CreateCompatibleDC( hdc );
       bmx              = bm;
       bmx.bmWidth      = wWidth;
       bmx.bmHeight     = wHeight;

       bmx.bmWidthBytes = ( bmx.bmWidth * bmx.bmBitsPixel + 15 ) / 16 * 2;

       hbmx = CreateBitmapIndirect( &bmx );

       hBmpOldX = ( HBITMAP ) SelectObject( hDcMemX, hbmx );
       StretchBlt( hDcMemX, 0, 0, wWidth, wHeight, hDcMem, 0, 0,
                   bm.bmWidth, bm.bmHeight, dwRaster );
       BitBlt( hdc, wRow, wCol, wWidth, wHeight, hDcMemX, 0, 0, dwRaster );
       SelectObject( hDcMemX, hBmpOldX );
       DeleteDC( hDcMemX );
       DeleteObject( hbmx );
    }

    SelectObject( hDcMem, hBmpOld );
    DeleteDC( hDcMem );
}


HB_FUNC( DRAWBITMAP ) //  hDC, hBitmap, nRow, nCol, nWidth, nHeight, nRaster
{
   DrawBitmap( ( HDC ) hb_parnl( 1 ), ( HBITMAP ) hb_parnl( 2 ),
               ( int ) hb_parni( 3 ), ( int ) hb_parni( 4 ),
               ( WORD ) hb_parni( 5 ), ( WORD ) hb_parni( 6 ), hb_parnl( 7 ) );
}

#pragma ENDDUMP
Marco Boschi
info@marcoboschi.it
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Comments and requests about TWBrowse
Posted: Fri Sep 28, 2012 10:52 AM

Very good :-)

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion