James Bott wrote:Enrico,
I did read your other reply and I do understand about the Windows issue. It doesn't matter if you can end the FW object because the object is still running under windows and thus it can still error out if the database source is ended. This is the point.
METHOD End() BLOCK ; // It has to be Block
{ | Self, lEnd | If( lEnd := ::lValid(), ::PostMsg( WM_CLOSE ),), lEnd }
James Bott wrote:I am going to email my test program to you to see if it errors out for you.
James Bott wrote:But if you then issue a oBrw:display() there is no error. What does this mean?
James Bott wrote:You haven't told me which versions you are using.
METHOD Display() CLASS TXBrowse
if !::lCreated
return nil
endif
::BeginPaint()
::Paint()
::EndPaint()
return 0
METHOD Display() CLASS TXBrowse
if !::lCreated
return nil
endif
::BeginPaint()
::Paint()
::EndPaint()
return 0
DATA lDataClosed INIT .f.
METHOD End() INLINE ::lDataClosed := Super:End()
METHOD Display()
if ::lCreated .and. ! ::lDataClosed
::BeginPaint()
::Paint()
::EndPaint()
endif
return nil
James Bott wrote:OK, but the FW code in the Display() method is still getting executed, thus the error.
But, couldn't we just use the existing lCreated flag, and just set it to false in the End method? Do we need the new lDataClosed flag, or is this just for clarity? Clarity is good though.
METHOD End() INLINE ::lCreated := ! Super:End()
#include 'fivewin.ch'
#include 'xbrowse.ch'
function Main()
local oWnd, oBar
USE CUSTOMER
DEFINE Window oWnd
define buttonbar oBar of oWnd
define button of oBar action (oBrw:End(), CUSTOMER->(DbCloseArea()), ;
oBrw:display(), msgInfo(valtype(oBrw)) )
@ 0, 0 XBROWSE oBrw OF oWnd ALIAS 'CUSTOMER' AUTOCOLS
oBrw:CreateFromCode()
oWnd:oClient:= oBrw
activate window oWnd
return nil
//------------------------------------------------------------------------------//
METHOD SetAdO( oRs, lAddCols, lAutoOrder, aFldNames ) CLASS TXBrowse
LOCAL nFields,nFor, oCol
if ::lCreated
if ::nDataType == DATATYPE_ARRAY
if SameAdoStruct( Self, oRs )
return nil
else
::aCols := {}
endif
else
::ClearBlocks()
::aCols := {}
endif
endif
msginfo( oRs ) // <-- this fires only on initial browse
// if this fires any other time .. I want to see it
::oRs := oRs
DEFAULT ::bGoTop := {|| If( ::oRs:RecordCount() > 0, ::oRs:MoveFirst(), nil ) } //,;
DEFAULT ::bGoBottom := {|| If( ::oRs:RecordCount() > 0, ::oRs:MoveLast(), nil ) } //,;
DEFAULT ::bSkip := {| n | AdoSkip( ::oRs, If( n==nil, 1, n ) ) } //,;
DEFAULT ::bBof := {|| ::oRs:Bof } //,;
DEFAULT ::bEof := {|| ::oRs:Eof } //,;
DEFAULT ::bBookMark := {| n | If( n == nil,;
If( ::oRs:RecordCount() > 0, ::oRs:BookMark, 0 ), ;
If( ::oRs:RecordCount() > 0, ( ::oRs:BookMark := n ), 0 ) ) } // , ;
DEFAULT ::bKeyNo := {| n | If( n == nil, ;
If( ::oRs:RecordCount() > 0, ::oRs:AbsolutePosition, 0 ), ;
If( ::oRs:RecordCount() > 0, ( ::oRs:AbsolutePosition := n ), 0 ) ) } //,;
DEFAULT ::bKeyCount := {|| ::oRs:RecordCount() }
James Bott wrote:I'm sorry I don't understand what you are saying. The browse has been "destroyed" but it is still exists and is still functioning. That is why it is erroring out.
James Bott wrote:Does your version of FWH not error out?
James Bott wrote:If so, what version are you using?
James Bott wrote:What does your Display() method look like?
METHOD Display() CLASS TXBrowse
if !::lCreated
return nil
endif
::BeginPaint()
::Paint()
::EndPaint()
return 0
James Bott wrote:Again I am confused. I did provide a sample.
nageswaragunupudi wrote:Mr EMG and Mr James
Instead of using array, please test with this example using DBF
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 95 guests