Comments and requests about TWBrowse

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Wed Sep 19, 2012 11:02 am

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

Marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Thu Sep 20, 2012 2: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?
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » Sat Sep 22, 2012 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Sat Sep 22, 2012 7: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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Tue Sep 25, 2012 3: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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » Wed Sep 26, 2012 5:55 am

Marco,

Try with different values from zero here:

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Wed Sep 26, 2012 6:55 am

Antonio,
perhaps negative numbers?
Bye
marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » Thu Sep 27, 2012 1:58 am

Yes, try it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Thu Sep 27, 2012 6:53 am

:(
Antonio,
unfortunately does not work.
bye
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » Thu Sep 27, 2012 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » 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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Comments and requests about TWBrowse

Postby MarcoBoschi » Fri Sep 28, 2012 7: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: Select all  Expand view
#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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Comments and requests about TWBrowse

Postby Antonio Linares » Fri Sep 28, 2012 10:52 am

Very good :-)

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 78 guests