Strange behavior in a program I just upgraded to FWH1201 .. I have a Mdi window with a Menu and button bar .. I have a MdiChild that overwrites the Menu and also has a button bar. The Mdichild has a xBrowse with an Ado recordset ..
On the Mdichild .. when you close it with either the Menu or button bar .. everything closes properly. If you Maximize the MDIChild and try to close the Child or program .. you get all kinds of xBrowse problems ..
- Code: Select all Expand view
Application
===========
Path and name: C:\Fox\Test\Test.Exe (32 bits)
Size: 2,153,472 bytes
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6476)
FiveWin Version: FWHX 11.12
Windows version: 5.1, Build 2600 Service Pack 3
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 02/13/2012, 09:14:02
Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: RECORDCOUNT
Args:
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4277 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYNO( 2842 )
Called from: Main.prg => (b)_USERBROW( 345 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:FOOTERSTR( 9354 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTFOOTER( 9415 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINTFOOTER( 1628 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1359 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1250 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11627 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => SYSREFRESH( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:END( 511 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORDIALOG( 407 )
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 157 )
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1654 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => SENDMESSAGE( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 379 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 886 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4277 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYNO( 2842 )
Called from: Main.prg => (b)_USERBROW( 345 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:FOOTERSTR( 9354 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:PAINTFOOTER( 9415 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINTFOOTER( 1628 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT( 1359 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY( 1250 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1666 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11627 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 270 )
Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG( 426 )
Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS( 31 )
Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETADO( 4277 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE( 407 )
Called from: => TXBROWSE:KEYCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:REFRESH( 1179 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:MAKEBRUSH( 5358 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE( 437 )
Called from: => TXBROWSE:RESIZE( 0 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1700 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11627 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => WNDADJCLIENT( 0 )
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:ADJCLIENT( 283 )
Called from: .\source\classes\WINDOW.PRG => TMDICHILD:RESIZE( 2136 )
Called from: => TWINDOW:HANDLEEVENT( 0 )
Called from: .\source\classes\MDICHILD.PRG => TMDICHILD:HANDLEEVENT( 322 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => WNDADJCLIENT( 0 )
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:RESIZE( 226 )
Called from: => TMDIFRAME:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Called from: => SETMENU( 0 )
Called from: .\source\classes\MENU.PRG => TMENU:END( 146 )
Called from: .\source\classes\MDICHILD.PRG => TMDICHILD:END( 266 )
Called from: .\source\classes\MDICLIEN.PRG => TMDICLIENT:LCLOSEALL( 204 )
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:END( 267 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:SYSCOMMAND( 2378 )
Called from: => TMDIFRAME:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
Here is a lengthy example that creates a Access database .. Open the UserInfo child with the Buttonbar .. close the program .. the program will close normally.. Open the program and maximize the MdiCHild with the xBrowse listbox .. then close the program .. and you will see the error.
- Code: Select all Expand view
// Mdichild test on close maximized
#include "FiveWin.ch"
#include "Xbrowse.ch"
STATIC oWnd,oBar,lOK,lOK1,oBrw,oWnd1
//-------------
Func Main()
Local catNewDB,xProvider,cFile,aDir,dExe,cDefa,mStart
Local oCn,cSql,oErr,oRsUser,cLOGIN,Saying,xLogin,cRights
Local cTitle,oButt1,oButt2,nYear,nScr1,nScr2,xMessage,cRdd
PUBLIC xCONNECT
lOK := .F.
lOK1 := .F.
//-- get timestamp on .exe //
cFILE := GetModuleFileName( GetInstance() )
aDIR := DIRECTORY( cFILE )
dEXE := aDIR[1] [3]
// where .exe started from is default directory //
mSTART := RAT( "\", cFILE )
cDEFA := SUBSTR(cFILE,1,mSTART-1)
aDIR := NIL
SET DEFA to ( cDEFA )
SET DELETED on
SET CENTURY on
SET 3DLOOK on
nYEAR := ( year( DATE() )-30 )
SET EPOCH to ( nYEAR )
REQUEST DBFCDX
rddsetdefault ( "DBFCDX" )
nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)
xPROVIDER := "Microsoft.Jet.OLEDB.4.0"
xSOURCE := cDEFA+"\Rick.mdb"
cRDD := xPROVIDER+" -- "+xSOURCE
// global connection string
xCONNECT := 'Provider='+xPROVIDER+';Data Source='+xSOURCE
If .not. File( cDefa+"\Rick.mdb" )
Ferase( cDefa+"\Rick.mdb" )
// create the adox object
Try
catNewDB := CreateObject("ADOX.Catalog")
Catch
MsgInfo( "Could not Create ADOX object")
Return(.f.)
End try
// create the table Rick.mdb
Try
catNewDB:Create('Provider='+xProvider+';Data Source='+xSource+';Jet OLEDB:Engine Type=5' )
Catch
MsgInfo( "Could not create the table "+xSource )
Return(.f.)
End Try
Try
oCn := CREATEOBJECT( "ADODB.Connection" )
Catch
MsgInfo( "Could not create the ADO object for connection")
End Try
TRY
oCn:Open( xCONNECT )
CATCH oErr
MsgInfo( "Could not open a Connection to Database "+xSource )
RETURN(.F.)
END TRY
cSQL := "CREATE TABLE USERINFO"
cSQL += "( "
cSQL += "[USEREID] char(18) NOT NULL, "
cSQL += "[USERID] char(8) NULL, "
cSQL += "[READONLY] char(1) NULL, "
cSQL += "[WRITEONLY] char(1) NULL, "
cSQL += "[SUPER] char(1) NULL, "
cSQL += "[LASTLOG] datetime NULL, "
cSQL += "[CREATEDATE] datetime NULL, "
cSQL += "[PASSWORD] char(10) NULL, "
cSQL += "CONSTRAINT PK_USERINFO PRIMARY KEY ( USEREID )"
cSQL += " )"
// create the table Userinfo
// with primary key
Try
oCn:Execute( cSQL )
Catch
MsgInfo( "Table USERINFO Failed" )
Return(.f.)
End try
oCn:Close()
oCn := nil
Endif
cLOGIN := UPPER( WNetGetuser() )+space(8) // fivewin
cLOGIN := SUBSTR(cLOGIN,1,8)
// open the Userinfo table record set
// append the first record
// could have also used a connection and the INSERT command
oRsUser := TOleAuto():New( "ADODB.Recordset" )
oRsUser:CursorType := 1 // opendkeyset
oRsUser:CursorLocation := 3 // local cache
oRsUser:LockType := 3 // lockoportunistic
// check for very first user
cSQL := "SELECT * FROM USERINFO"
TRY
oRsUser:Open( cSQL, xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening USERINFO table here" )
RETURN(.F.)
END TRY
If oRsUser:eof
oRsUser:AddNew()
oRsUser:Fields("UserEid"):Value := "011111111111111111"
oRsUser:Fields("UserId"):Value := cLOGIN
oRsUser:Fields("ReadOnly"):Value := "Y"
oRsUser:Fields("WriteOnly"):Value := "Y"
oRsUser:Fields("Super"):Value := "Y"
oRsUser:Fields("CreateDate"):Value := dtoc(DATE())+" "+time()
oRsUser:Fields("LastLog"):Value := dtoc(DATE())+" "+time()
oRsUser:Fields("PassWord"):Value := "ADMIN"
oRsUser:Update()
Endif
xLogin := oRsUser:Fields("UserId"):Value
oRsUser:CLose()
cRIGHTS := "(RWS)"
* MENU BuildMenu(cOLDDEFA,dEXE,cRDD);
xMESSAGE := "User "+xLOGIN+" Rights "+cRIGHTS+ ;
" Default= "+cDEFA+" Rdd= "+cRDD+ ;
" Revision "+DTOC(dEXE)+;
" -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)
cTitle := "Test MDI CHild Close Maximized"
DEFINE WINDOW oWnd ;
TITLE cTITLE ;
MENU BuildMenu();
MDI
DEFINE BUTTONBAR oBar OF oWnd SIZE 65,70 3DLOOK 2007
oBar:SetColor(0)
DEFINE BUTTON oButt1 OF oBar FileName (cDefa+"\Icons\REQUEST.bmp") , ;
(cDefa+"\Icons\DREQUEST.bmp"), ;
(cDefa+"\Icons\DREQUEST.bmp") ;
MESSAGE "User Information" ;
ACTION _UserBrow( oWnd,oBar ) ;
PROMPT "User Info"
DEFINE BUTTON oButt2 OF oBar FileName (cDefa+"\Icons\CLOSE.bmp"), ;
(cDefa+"\Icons\DCLOSE.bmp"),;
(cDefa+"\Icons\DCLOSE.bmp") ;
MESSAGE "Close Application" ;
ACTION ( oWnd:End() ) ;
PROMPT "Quit"
SET MESSAGE OF oWnd ;
to xMESSAGE CLOCK 2007
ACTIVATE WINDOW oWnd MAXIMIZED ;
VALID ( IIF( !lOK, ExitPgm(.T.), .F. ))
RETURN( NIL )
//---------------------------
Static FUNCTION BuildMenu( cOLDDEFA,dEXE,cRDD )
LOCAL oMENU, cDEFA, cRIGHTS, nSCR1,nSCR2
cDEFA := SET(7)
nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)
MENU oMenu 2007
menuitem "Login..." ;
MENUITEM "&About..."
MENUITEM "&Quit" ;
MESSAGE "Close this program";
ACTION oWND:END()
ENDMENU
RETURN( oMenu )
//---------------------------
Static FUNCTION BuildMenu1()
LOCAL oMENU1
cDEFA := SET(7)
nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)
MENU oMenu1 2007
menuitem "Login..." ;
ENDMENU
RETURN( oMenu1 )
//-----------------------
Static FUNCTION ExitPgm( lCLEAN )
LOCAL lOK3
lOK3 := .F.
IF lCLEAN = .T.
lOK3 := .T.
lOK := .T.
SET RESOURCES to
ENDIF
RETURN( lOK3 )
//---------------------------------
Static Func _UserBrow( oWndMDI,oBar1 )
LOCAL SAYING, oRsUser, cSQL, oERR, oBar2,oCol
LOCAL oBtn1,oBtn2,oBtn3,oBtn4,oBtn5,oBtn6,cDefa
LOCAL nWD,nHT
LOCAL cTITLE
cDEFA := SET(7)
SysReFresh()
cSQL := "SELECT * FROM USERINFO order by userid"
oRsUser := TOleAuto():New( "ADODB.Recordset" )
oRsUser:CursorType := 1 // opendkeyset
oRsUser:CursorLocation := 3 // local cache
oRsUser:LockType := 3 // lockoportunistic
TRY
oRsUser:Open(cSQL,xConnect )
CATCH oErr
MsgInfo( "Error in Opening USERINFO table" )
RETURN(.F.)
END TRY
lOK1 := .F.
oBar1:Hide()
SysReFresh()
DEFINE BUTTONBAR oBar2 OF oWndMDI SIZE 65,70 3DLOOK 2007
oBar2:SetColor(0)
DEFINE BUTTON oBtn1 OF oBar2 FileName (cDefa+"\Icons\REQADD.bmp"), ;
(cDefa+"\Icons\DREQADD.bmp"),;
(cDefa+"\Icons\DREQADD.bmp") ;
MESSAGE "Add Users" ;
ACTION ( Msginfo( "Unavailable" )) ;
PROMPT "Add"
DEFINE BUTTON oBtn6 OF oBar2 FileName (cDefa+"\Icons\REQCLOSE.bmp"), ;
(cDefa+"\Icons\DREQCLOSE.bmp"),;
(cDefa+"\Icons\DREQCLOSE.bmp") ;
MESSAGE "Close Browse" ;
ACTION ( oWnd1:End() ) ;
PROMPT "Close"
cTITLE := "User Information Browse"
lOK1 := .F.
DEFINE WINDOW oWnd1 ;
FROM 0,0 to 30,75 ;
Menu BuildMenu1() ; // take this Buildmenu out and program will not fail
TITLE cTITLE ; // when mdichild is maximized
NOMINIMIZE ;
MDICHILD
@ 0, 0 xBROWSE oBrw of oWnd1 ;
RECORDSET oRsUser ;
COLUMNS "USERID", ;
"READONLY", ;
"WRITEONLY", ;
"SUPER", ;
"CREATEDATE", ;
"LASTLOG" ;
COLSIZES 80,80,80,80,80,80 ;
HEADERS "UserId", ;
"Read", ;
"Write", ;
"Super", ;
"Created", ;
"LastLog" ;
AUTOSORT AUTOCOLS FASTEDIT LINES CELL // use fastedit if you want to edit cells
oWnd1:oClient := oBrw
oBrw:lHScroll := .f. // turn off horiz scroll bar
oBrw:lFooter := .t.
oCol := oBrw:aCols[ 1 ]
oCol:bFooter := { || Ltrim( Str( oBrw:KeyNo() ) ) + " / " + LTrim( Str( oBrw:KeyCount() ) ) }
oCol:cHeader := "UserId"
oBrw:bChange := { || oCol:RefreshFooter() }
oBrw:CreateFromCode()
ACTIVATE WINDOW oWND1 ;
ON INIT( oBrw:SetFocus(), .F. ) ;
VALID ( IIF( !lOK1, UserClose(.T.,oWnd1,oRsUser,oBar1,oBar2 ), .F. ))
Return(nil)
//-------------------------------
Static FUNCTION UserClose( lCLEAN,oWndchild,oRsUser,oBar1,oBar2 )
LOCAL lOK3
IF lCLEAN = .T.
lOK3 := .T.
lOK1 := .T.
oBrw:cALIAS:=nil
try
oRsUser:CLose()
catch
end try
oBar2:End()
oWndChild:End()
oBar1:Show()
ENDIF
RETURN( lOK3 )
// -- end