#define aObjVar(i,j) aArrayVars[1][i][j]
#define aAlias(i,j) aArrayVars[2][i][j]
#define oWndChild 1
#define oDlg 2
#define oSayProc 3
#define oSayEmpr 4
#define oSayFecha 5
aObjVar( oSayEmpr, nWnd )
CLASS TMiAplicacion
DATA oWndClientes
DATA oWndArticulos
DATA oWndFacturas
...
METHOD New() // desde donde construyes todo
ENDCLASS
public oMiAplicacion := TMiAplicacion():New()
aObjVar( oSayEmp, [b]nWnd[/b] )
if nWnd = nil
nWnd := 1
else
nWnd ++
endif
mantonio_08 wrote:QUE ESTAS INTANTANDO HACER AMIGO::
NO TE ENTENDI..
PODES PONER UN CODE DE LO Q QUIERES HACER::
HABER SI PODEMOS AYUDARTE
nWnd = AScan( oWndPrincipal:oWndClient:aWnd, { | oWndChild | oWndChild == oWndFacturas } )
aObjVar( oSayEmp, nWnd )
nWnd = AScan( oWndPrincipal:oWndClient:aWnd, { | oWndChild | oWndChild == oWndPrincipal:oWndActive } )
aObjVar( oSayEmp, nWnd )
#include "FiveWin.ch"
#define aObjVar(i,j) aArrayVars[1][i][j]
#define aAlias(i,j) aArrayVars[2][i][j]
#define nTipVarMax 2 //Tipo máximo de variables (ObjVar y Alias = 2)
#define nWndMax 10 //Tope ventanas Man_Art()
// Objetos y variables
#define oWndChild 1
#define oDlg 2
#define oSayProc 3
#define oSayEmpr 4
#define oArt 5
#define cProc 6
#define cEmpresa 7
#define nObjVarMax 7 //Número máximo de variables y objetos
// Alias
#define Tec 1
#define Art 2
static aArrayVars[nTipVarMax][nObjVarMax][nWndMax]
static nWnd
**********************************************************************************************************************
function ManArt()
**********************************************************************************************************************
if nWnd = nil
nWnd := 1
else
nWnd ++
endif
aAlias( Tec, nWnd ) := CnwOpenDbf( oWndPrinc, "TEC.DBF", 5, .t., .f. )
//Funcion para abrir una base de datos compartida o exclusiva, retorna un alias nuevo y único
SET INDEX TO Tec_Cod, Tec_Nom
aAlias( Art, nWnd ) := CnwOpenDbf( oWndPrinc, "ART.DBF", 5, .t., .f. )
SET INDEX TO Art_Cod, Art_Nom, Art_Sub, Art_Int
DATABASE aObjVar( oArt, nWnd )
aObjVar( oArt, nWnd ):lOemAnsi = .t.
aObjVar( oArt, nWnd ):Load()
aObjVar( oArt, nWnd ):bBOF = { || MsgInfo( "Primer Registro" ) }
aObjVar( oArt, nWnd ):bEOF = { || MsgInfo( "Último Registro" ) }
SELECT ( aAlias( Art, nWnd ) )
DEFINE WINDOW aObjVar( oWndChild, nWnd ) MDICHILD OF oWndPrinc ;
FROM 5,5 TO 6,6;
COLOR "N/W" ;
BORDER NONE // prevent resizing
DEFINE DIALOG aObjVar( oDlg, nWnd ) RESOURCE "Articulos" OF aObjVar( oWndChild, nWnd )
REDEFINE SAY aObjVar( oSayProc, nWnd ) PROMPT aObjVar( cProc, nWnd ) ID 10 OF aObjVar( oDlg, nWnd )
REDEFINE SAY aObjVar( oSayEmpr, nWnd ) PROMPT aObjVar( cEmpresa, nWnd ) ID 20 OF aObjVar( oDlg, nWnd )
REDEFINE GET aObjVar( oGetArt_Cod, nWnd ) VAR aObjVar( oArt, nWnd ):Art_Cod ID 40 OF aObjVar( oDlg, nWnd ) PICTURE '@!' UPDATE
REDEFINE GET aObjVar( oArt, nWnd ):Art_Nom ID 50 OF aObjVar( oDlg, nWnd ) PICTURE '@!' UPDATE
REDEFINE GET aObjVar( oArt, nWnd ):Art_Col ID 60 OF aObjVar( oDlg, nWnd ) PICTURE '@!' UPDATE
REDEFINE BUTTON aObjVar( oBtnAnterior, nWnd ) ID 1000 OF aObjVar( oDlg, nWnd );
ACTION ( aObjVar( oArt, nWnd ):Skip( -1 ) , If( aObjVar( oArt, nWnd ):BoF(), MsgBeep(),), aObjVar( oDlg, nWnd ):Update() )
REDEFINE BUTTON aObjVar( oBtnSiguiente, nWnd ) ID 2000 OF aObjVar( oDlg, nWnd );
ACTION ( aObjVar( oArt, nWnd ):Skip(),;
If( aObjVar( oArt, nWnd ):EoF(), aObjVar( oArt, nWnd ):Skip( -1 ),), aObjVar( oDlg, nWnd ):Update() )
ACTIVATE DIALOG aObjVar( oDlg, nWnd ) NOWAIT CENTERED;
ON INIT ( aObjVar( oBtnSiguiente, nWnd ):SetFocus(), aObjVar( oDlg, nWnd ):Move( 0, 0 ), .f. );
VALID ( aObjVar( oWndChild, nWnd ):End(), .t. )
aObjVar( oWndChild, nWnd ):nWidth := aObjVar( oDlg, nWnd ):nWidth+7
aObjVar( oWndChild, nWnd ):nHeight := aObjVar( oDlg, nWnd ):nHeight+32
ACTIVATE WINDOW aObjVar( oWndChild, nWnd )
return nil
mantonio_08 wrote:disculpa amigo el comentario,, y lo directo::
pero me podrias cual es el beneficio que tienes al programar una aplicacion de esta manera,, metiendo en varios array todo los objetos , y datos necesarios para crear tus window, dialog, say, get, etc,etc.::
??? que beneficio esperas::
#include "FiveWin.ch"
#define aObjVar(i,j) aArrayVars[1][i][j]
#define aAlias(i,j) aArrayVars[2][i][j]
#define nTipVarMax 2 //Tipo máximo de variables (ObjVar y Alias = 2)
#define nWndMax 10 //Tope ventanas Man_Art()
// Objetos y variables
#define oDlg 1
#define oSayNom 2
#define oSayDir 3
#define oCli 4
#define oBtnAnterior 5
#define oBtnSiguiente 6
#define oBtnVer 7
#define nObjVarMax 7 //Número máximo de variables y objetos
// Alias
#define Cli 1
static oWndPrinc
static aArrayVars[nTipVarMax][nObjVarMax][nWndMax]
static nWnd
**********************************************************************************************************************
function Main()
**********************************************************************************************************************
DEFINE WINDOW oWndPrinc Title "Ventanas" MDI MENU MenuPrin()
ACTIVATE WINDOW oWndPrinc MAXIMIZED
return nil
**********************************************************************************************************************
function MenuPrin()
**********************************************************************************************************************
local oMenu
MENU oMenu
MENUITEM "&Ventanas"
MENU
MENUITEM "&Ventanas" ACTION ( ManArt() )
ENDMENU
ENDMENU
return oMenu
**********************************************************************************************************************
function ManArt()
**********************************************************************************************************************
if nWnd = nil
nWnd := 1
else
// Hacer control ventanas máximas.
nWnd ++
endif
aAlias( Cli, nWnd ) := NewAlias( "Clients.dbf" )
DbUseArea( .T.,, "Clients.dbf", aAlias( Cli, nWnd ), .t., .f. )
DATABASE aObjVar( oCli, nWnd )
aObjVar( oCli, nWnd ):Load()
aObjVar( oCli, nWnd ):bBOF = { || MsgInfo( "Primer Registro" ) }
aObjVar( oCli, nWnd ):bEOF = { || MsgInfo( "Último Registro" ) }
DEFINE DIALOG aObjVar( oDlg, nWnd ) TITLE "Diáologo: " + Str( nWnd ) FROM 0,0 TO 20,40 OF oWndPrinc
@ 1, 1 SAY aObjVar( oSayNom, nWnd ) PROMPT aObjVar( oCli, nWnd ):Name OF aObjVar( oDlg, nWnd ) UPDATE
@ 2, 1 SAY aObjVar( oSayDir, nWnd ) PROMPT aObjVar( oCli, nWnd ):Adress OF aObjVar( oDlg, nWnd ) UPDATE
@ 5, 1 BUTTON aObjVar( oBtnAnterior, nWnd ) PROMPT "Anterior" OF aObjVar( oDlg, nWnd );
ACTION ( aObjVar( oCli, nWnd ):Skip( -1 ) , If( aObjVar( oCli, nWnd ):BoF(), MsgBeep(),), aObjVar( oDlg, nWnd ):Update() )
@ 6, 1 BUTTON aObjVar( oBtnSiguiente, nWnd ) PROMPT "Siguiente" OF aObjVar( oDlg, nWnd );
ACTION ( aObjVar( oCli, nWnd ):Skip(),;
Iif( aObjVar( oCli, nWnd ):EoF(), aObjVar( oCli, nWnd ):Skip( -1 ),), aObjVar( oDlg, nWnd ):Update() )
@ 7, 1 BUTTON aObjVar( oBtnVer, nWnd ) PROMPT "Ver" OF aObjVar( oDlg, nWnd );
ACTION ( MsgInfo( "Alias: " + aAlias( Cli, nWnd ) + CRLF +;
"Valor nWnd: " + Str( nWnd ) ) )
ACTIVATE DIALOG aObjVar( oDlg, nWnd ) NOWAIT CENTERED;
ON INIT ( aObjVar( oBtnSiguiente, nWnd ):SetFocus(), aObjVar( oDlg, nWnd ):Move( 0, 0 ) );
VALID ( aObjVar( oCli, nWnd ) )->( DbCloseArea(), .t. )
return nil
**********************************************************************************************************************
function NewAlias( cNomDbf )
**********************************************************************************************************************
static nNum := 0
local cAlias := ""
nNum++
cAlias := SubStr( cFileNoExt( cFileName( cNomDbf ) ), 1, 4 ) + LTRIM( STR( nNum ) )
return ( cAlias )
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: No registered users and 45 guests