/*----------------------------------------------------------------------------*/
#include "prestamos.ch"
#ifdef __HARBOUR__
#ifndef __XHARBOUR__
#include "xhb.ch"
#include "xhbcls.ch"
#endif
#endif
#include "hbclass.ch"
/*----------------------------------------------------------------------------*/
PROCEDURE OverrideAndExtend()
OVERRIDE METHOD GETDLGCODE IN CLASS TBUTTON WITH KGETDLGCODE
EXTEND CLASS TCONTROL WITH METHOD MyDisable
EXTEND CLASS TDIALOG WITH METHOD RefreshDialog
EXTEND CLASS TFOLDER WITH METHOD GoFirstControl
EXTEND CLASS TFOLDER WITH METHOD RefreshPages
EXTEND CLASS TXBROWSE WITH METHOD RefreshTotals
EXTEND CLASS TXBROWSE WITH METHOD SetMyBmpSort
EXTEND CLASS TXBROWSE WITH METHOD MyConfig
EXTEND CLASS TMYSQLSERVER WITH METHOD ShowError
RETURN
/*----------------------------------------------------------------------------*/
FUNCTION KGetDlgCode( nLastKey )
LOCAL Self := hb_QSelf()
::oWnd:nLastKey := nLastKey
DO CASE
CASE !hb_isNil( ::oWnd:oWnd ) .and. ( ::oWnd:oWnd:IsKindOf( "TFOLDER" ) .or. ::oWnd:oWnd:IsKindOf( "TFOLDEREX" ) )
RETURN DLGC_WANTALLKEYS
CASE nLastKey == VK_ESCAPE .and. !hb_isNil( ::oWnd:oWnd ) .and. ( ::oWnd:oWnd:IsKindOf( "TWINDOW" ) .or. ::oWnd:IsKindOf( "TDIALOG" ) .or. ::oWnd:IsKindOf( "TPAGES" ) )
RETURN DLGC_WANTALLKEYS
ENDCASE
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION MyDisable( aCtrlType )
LOCAL Self := hb_QSelf()
IF ( ::ClassName() IN aCtrlType )
::bWhen := NIL
::Disable()
ENDIF
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION RefreshDialog( nPos )
LOCAl Self := hb_QSelf()
DEFAULT nPos := 0
AEval( ::aControls, { |oCtrl| oCtrl:Refresh() } )
IF nPos > 0
IF Between( nPos, 1, Len( ::aControls ) )
::aControls[ nPos ]:SetFocus()
ENDIF
ENDIF
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION GoFirstControl()
LOCAL Self := hb_QSelf()
IF Len( ::aDialogs ) > 0 .and. Len( ::aDialogs[ 01 ]:aControls[ 01 ] ) > 0
::aDialogs[ 1 ]:aControls[ 1 ]:SetFocus()
ENDIF
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION RefreshPages( nSelectPage )
LOCAl Self := hb_QSelf()
LOCAL oPage
DEFAULT nSelectPage := 0
FOR EACH oPage IN ::aDialogs
AEval( oPage:aControls, {|oCtrl| oCtrl:Refresh() } )
NEXT
IF Between( nSelectPage, 1, Len( ::aDialogs ) )
::SetOption( nSelectPage )
ENDIF
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION RefreshTotals( lSavePos )
LOCAL Self := hb_QSelf()
LOCAL nRecNo := Eval( ::bBookMark )
DEFAULT lSavePos := TRUE
::MakeTotals()
IF lSavePos .and. nRecNo > 0
Eval( ::bBookMark, nRecNo )
ENDIF
::Refresh()
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION SetMyBmpSort()
LOCAL Self := hb_QSelf()
LOCAL oBmp, hBmp
IF ::aSortBmp[ 1, 1 ] != 0
DeleteObject( ::aSortBmp[ 1, 1 ] )
ENDIF
IF ::aSortBmp[ 2, 1 ] != 0
DeleteObject( ::aSortBmp[ 2, 1 ] )
ENDIF
::aSortBmp := {}
DEFINE BITMAP oBmp NAME "BMS_ARROWDOWN2"
hBmp := oBmp:hBitmap
AAdd( ::aSortBmp, { hBmp, 0, nBmpWidth( hBmp ), nBmpHeight( hBmp ), NIL, FALSE } )
DEFINE BITMAP oBmp NAME "BMS_ARROWUP2"
hBmp := oBmp:hBitmap
AAdd( ::aSortBmp, { hBmp, 0, nBmpWidth( hBmp ), nBmpHeight( hBmp ), NIL, FALSE } )
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION MyConfig( lOrder, nFreeze, lCell, lColSize, lSchemeColor, lRowCount )
LOCAL Self := hb_QSelf()
LOCAL cAlias := ::cAlias
DEFAULT lOrder := FALSE,;
lCell := FALSE,;
lColSize := FALSE,;
lSchemeColor := FALSE,;
nFreeze := 0,;
lRowCount := FALSE
::lGDIP := FALSE
::lFlatStyle := FALSE
::nRowHeight := 24
::lRecordSelector := TRUE
::nStretchCol := STRETCHCOL_LAST
::nColDividerStyle := LINESTYLE_DARKGRAY
::lColDividerComplete := TRUE
::nRowDividerStyle := LINESTYLE_NOLINES
//::nColDividerStyle := LINESTYLE_NOLINES
IF !Empty( cAlias )
::bGoTop := {|| ( cAlias )->( dbGoTop() ) }
::bGoBottom := {|| ( cAlias )->( dbGoBottom() ) }
::bSkip := {|n| IIf( hb_isNil( n ), n := 1, ), ( cAlias )->( dbSkipper( n ) ) }
::bBof := {|| ( cAlias )->( Bof() ) }
::bEof := {|| ( cAlias )->( Eof() ) }
::bBookMark := {|n| IIf( hb_isNil( n ), ( cAlias )->( RecNo() ), ( cAlias )->( dbGoTo( n ) ) )}
::bKeyCount := {|| ( cAlias )->( ordKeyCount() ) }
::bKeyNo := {|| ( cAlias )->( ordKeyNo() ) }
ENDIF
::bClrHeader := {|| { CLR_BLUE, CLR_BROWTIT, CLR_BLACK } }
::bClrSelFocus := {|| { CLR_WHITE, CLR_MIDNIGHTBLUE } }
::bClrFooter := {|| { CLR_RED, CLR_BROWTIT, CLR_BLACK } }
::bClrSel := {|| { CLR_WHITE, CLR_BLACK } }
::l2007 := TRUE
::lFullGrid := FALSE
::lAllowColHiding := FALSE
::lAllowColSwapping := FALSE
::lAllowRowSizing := FALSE
::lAllowCopy := FALSE
::lKinetic := FALSE
::lKineticBrw := FALSE
::lHScroll := FALSE
IF nFreeze > 0
::nFreeze := nFreeze
ENDIF
IF !lCell
::nMarqueeStyle := MARQSTYLE_HIGHLROW
ELSE
::bClrRowFocus := {|| { CLR_BLACK, RGB( 185, 220, 255 ) } }
::nMarqueeStyle := MARQSTYLE_HIGHLCELL
ENDIF
//AEval( ::aCols, {|oCol| oCol:cSortOrder := NIL, IIf( !lColSize, ( oCol:lAllowSizing := FALSE ), NIL ) } )
AEval( ::aCols, {|oCol| IIf( !lColSize, ( oCol:lAllowSizing := FALSE ), NIL ) } )
IF lSchemeColor
ColorScheme( Self )
ENDIF
IF Type( "nScale" ) != "U" .and. nScale > 1
AEval( ::aCols, {|oCol| IIf( ValType( oCol:nWidth ) == "N", ( oCol:nWidth *= nScale ), NIL ) } )
ENDIF
IF lRowCount
::nRecSelWidth := 50 * IIf( Type( "nScale" ) != "U" .and. nScale > 1, nScale, 1 )
::nRecSelColor := CLR_MYCELESTE2
::bRecSelHeader := "#"
::bRecSelData := {|oB| oB:KeyNo }
ENDIF
::SetMyBmpSort()
RETURN NIL
/*----------------------------------------------------------------------------*/
FUNCTION ShowError()
LOCAL Self := hb_QSelf()
IF ::nError > 0
MsgStop( ::cError, "MYSQL-ERROR" )
ENDIF
RETURN NIL
/*----------------------------------------------------------------------------*/
/*EOF*/
/*----------------------------------------------------------------------------*/