#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oBrw
USE CUSTOMER
DEFINE DIALOG oDlg
@ 0 , 0 LISTBOX oBrw FIELDS
ACTIVATE DIALOG oDlg;
ON INIT ( oDlg:Maximize(),;
oDlg:SetControl( oBrw ) );
CENTER
RETURN NIL
// Test disabled TWBrowse for painting while disabled.
// Use with FWH\samples\customer.dbf file
#include "fivewin.ch"
function main()
local oWnd, oLbx, oBar
ferase("test02.log")
use customer
define window oWnd title "Test Browse"
define buttonbar oBar of oWnd
define button of oBar action oLbx:disable()
define button of oBar action oLbx:enable()
define button of oBar action writeFile("test02.log","-----------")
define button of oBar action LOCKWINDOWUPDATE( oLbx:hWnd )
define button of oBar action LOCKWINDOWUPDATE()
@0,0 listbox oLbx fields first, last;
alias "customer";
of oWnd
oLbx:bSkip:= {|nRecs| ( msgBeep(),sleep(100),sysrefresh(),logfile( "test02.log" , ;
{ recno() } ), customer->(dbskipper( nRecs)) ) }
oWnd:oClient:= oLbx
activate window oWnd
return nil
I don't know if TWBrowse can be improved but the major benefit would be in improving DBF's shared access speed, if it were possible.
Method LostFocus()
::lHasFocus:=.f.
// copy visible records to buffer array
return nil
Methd GotFocus()
::lHasFocus:=.t.
return nil
Method Paint()
...
if ::lHasFocus
// paint using records
else
// paint using buffer array
endif
...
return nil
Here is a possible solution. In the LostFocus() method, copy all visible records into a buffer array. Then during refresh if the control does not have focus() then repaint using the array, otherwise repaint by reading records from the source.
When the control gets focus, reset the lHasFocus variable to .t.
There is a little flickering in your sample and in this (rewritten by me) there are other problems that I am not able to resolve.
There is a little flickering in your sample
#include 'fivewin.ch'
#include 'xbrowse.ch'
#xtranslate DelObj <o> => If <o> != nil; DeleteObject( <o> ); endif; <o> := nil
CLASS TXBR3 FROM TXBROWSE
CLASSDATA lRegistered AS LOGICAL // used internally
DATA hSaveScr
METHOD Paint()
METHOD Destroy()
ENDCLASS
METHOD Paint() CLASS TXBR3
local aInfo
if ::hSaveScr != nil .and. GetFocus() != ::hWnd
aInfo := ::DispBegin()
DrawBitmap( ::hDC, ::hSaveScr, 0, 0 )
::DispEnd( aInfo )
else
Super:Paint()
DelObj ::hSaveScr
::hSaveScr := WndBitMap( ::hWnd )
endif
return nil
METHOD Destroy() CLASS TXBR3
DelObj ::hSaveScr
return Super:Destroy()
Since in a dialog I have other obiects... is it possible in Paint method to check Focus of entire dialog instead of TWBROWSE object?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 67 guests