I wanted to change a Browse from Dialog to a MDI-Child
Following happens :
//------------ Quick- Browse Outlook2003 ---------------------------
FUNCTION PROG_4(oWnd,oDlg,aCtrl,nPage,oOutL2003)
local oDlg3, oFile1, cFile1 := "", oBtn1, oBtn2, obtn3, oBtn4, oBrw5, DBFTYP := ""
local oFilter, cFilter := SPACE( 70 ), cFELD := "", l_INDEX := .F.
local oSUCH, cSUCH := "", aSCOPE, nSCOPE := 1
local oEXPORT, cEXPORT := "EXPORT.DBF ", oINDKEY, cINDKEY := ""
local oOemAnsi, cOemAnsi := ""
DEFINE DIALOG aCtrl[nPage] RESOURCE "BROWSER" OF oDlg PIXEL
cFile1 := GET_DBF2() // the selected Database
DBFTYP := CabDbf (cFile1) // DBF-Header-Info CDX or NTX
IF lOemAnsi = .T. // wants to open a Oem or Ansi - Database
cOemAnsi := "ANSI"
ELSE
cOemAnsi := "OEM"
ENDIF
IF DBFTYP = "CDX"
RDDSETDEFAULT( "DBFCDX" )
ELSE
RDDSETDEFAULT( "DBFNTX" )
ENDIF
// -------- Open the Database ---------------------------------
DBSELECTAREA(1)
USE &cFile1
DBGOTOP()
BROWSE() // Database is open and shows the Data
// ------------------------------------------
// Dosn't work in a MDI-Child
// as a ARRAY and in a Dialog it is OK
//-------------------------------------------
oBrw5 := TXBrowse():New( aCtrl[nPage] )
// => aCtrl[nPage] is a MDI-Child of Outlook2003
oBrw5:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw5:nColDividerStyle := LINESTYLE_BLACK
oBrw5:nRowDividerStyle := LINESTYLE_BLACK
oBrw5:lColDividerComplete := .t.
oBrw5:nHeaderLines := 1
oBrw5:nDataLines := 1
oBrw5:lAllowColSwapping := .t.
oBrw5:lOemToAnsi := lOemAnsi // New OemToAnsi
oBrw5:SetRDD()
lClrFlag:=.f.
for nFor := 1 to len( oBrw5:aCols )
// Error-Message
// NO WORKAREA in USE !!!!
// as a ARRAYS it is OK
// ------------------------------------
oCol := oBrw5:aCols[ nFor ]
oBrw5:bSkip:={| nRecs | ( if(nRecs == nil, nRecs := 1,),nRecs:= ;
(1)->(dbskipper( nRecs )), ;
lClrFlag:= if( nRecs % 2 = 0, lClrFlag,!lClrFlag), nRecs) }
// Define alternating row colors
oBrw5:bClrStd:= {|| if(lClrFlag,{ CLR_BLACK, COLOR_LIGHT }, ;
{ CLR_BLACK, COLOR_DARK }) }
oCol:nEditType := 1
oCol:bOnPostEdit := {|o, v, n| IIF( n != VK_ESCAPE, ;
( IIF( Net_Lock(), ;
IIF( lOemAnsi = .T., ;
FieldPut( o:nCreationOrder, AnsiToOem(v) ), ;
FieldPut( o:nCreationOrder, v ) ), Net_ULock () ), NIL ), ) }
next
oBrw5:CreateFromResource( 110 )
aCtrl[nPage]:oClient := oBrw5
ACTIVATE DIALOG aCtrl[nPage] NOWAIT ;
ON INIT ( aCtrl[nPage]:Move( aCORS [1] + 10, aCORS [2] + 230, ;
aCtrl[nPage]:nWidth, aCtrl[nPage]:nHeight, .f. ) )
CLOSE DATABASE
RETURN( NIL )
regards
U. König