/* * Xailer source code: * * ErrorForm.prg * Clase TErrorForm() * * Copyright 2003, 2007 Jose F. Gimenez * Copyright 2003, 2007 Xailer.com * All rights reserved * */ #include "Xailer.ch" //-------------------------------------------------------------------------- CLASS TErrorForm FROM TForm COMPONENT oMemo1 COMPONENT oMemo2 COMPONENT oDetails DATA cMessage DATA aOptions METHOD CreateForm() // --> Self METHOD Details( oSender ) // --> Nil RESERVED: METHOD WMNCLButtonDblClk( nHitTest ) ENDCLASS //-------------------------------------------------------------------------- METHOD CreateForm() CLASS TErrorForm LOCAL i ::nWidth := 600 ::nHeight := 140 ::nClientHeight := 107 ::cText := LT( XA_MSG_ERROR_TITLE ) ::oIcon := IDI_HAND ::nBorderStyle := bsDIALOG ::lMinimizeBox := .F. ::lAutoScroll := .F. ::oFont := Application:oFont:Clone() ::Create() WITH OBJECT ::oMemo1 := TMemo():New( Self ) :SetBounds( 6, 8, 582, 60 ) :lReadOnly := .T. :lVScroll := .F. :nAnchors := akLEFTTOPRIGHT :cText := ::cMessage :Create() END FOR i := 1 TO Len( ::aOptions ) WITH OBJECT TButton():New( Self ) :SetBounds( ( i - 1 ) * 80 + 5, 75, 75, 25 ) :cText := ::aOptions[ i ] :nModalResult := i :Create() END NEXT WITH OBJECT ::oDetails := TButton():New( Self ) :SetBounds( 487, 75, 100, 25 ) :nAnchors := akTOPRIGHT :cText := LT( XA_MSG_ERROR_DETAILS ) + " >>>" :OnClick := "Details" :Create() END WITH OBJECT ::oMemo2 := TMemo():New( Self ) :SetBounds( 6, 110, 582, 150 ) :lReadOnly := .T. :cText := MemoRead( "Error.log" ) :oFont := TFont():Create( "Courier New" ) :lVisible := .F. :Create() END ::oActiveControl := ::aControls[ 2 ] ::oActiveControl:lDefault := .T. RETURN Self //-------------------------------------------------------------------------- METHOD WMNCLButtonDblClk( nHitTest ) CLASS TErrorForm /* NOTA: Esto se usa para maximizar la ventana al hacer doble click en el titulo, aunque sea un dialogo y no tenga boton de maximizar - [JFG] NOTE: This is used to maximize the window when the user double clicks on the caption, although it's a dialog and doesn't have a maximize button - [JFG] */ IF nHitTest == HTCAPTION IF IsZoomed( ::Handle ) ::Restore() ::oDetails:Enable() ELSE IF !( ::oDetails:cText = "<" ) ::Details() ENDIF ::Maximize() ::oDetails:Disable() ENDIF ::oMemo2:SetBounds( ,, ::nClientWidth - 13, ::nClientHeight - ::oMemo2:nTop - 6 ) RETURN 0 ENDIF RETURN Nil //-------------------------------------------------------------------------- METHOD Details( oSender ) CLASS TErrorForm IF ::oDetails:cText = "<" ::oDetails:cText := LT( XA_MSG_ERROR_DETAILS ) + " >>>" ::oDetails:oParent:nClientHeight := MulDiv( 107, Application:nScale, 100 ) ::oMemo2:Hide() ELSE ::oDetails:cText := "<<< " + LT( XA_MSG_ERROR_DETAILS ) ::oDetails:oParent:nClientHeight := MulDiv( 265, Application:nScale, 100 ) ::oMemo2:SelectAll() ::oMemo2:SendMsg( WM_COPY, 0, 0 ) ::oMemo2:SelectNone() ::oMemo2:Show() ENDIF RETURN Nil //--------------------------------------------------------------------------