Page 1 of 1
Antonio, tFolder():Initiate não executa
Posted: Tue Feb 13, 2007 8:10 pm
by Rossine
Olá Antonio,
Como faço para que o método INITIATE de TFOLDER seja executado no programa abaixo:
Code: Select all
// Dinamically building a folder ontop of a Dinamic DialogBox
#include "FiveWin.ch"
static oDlg, oFld
//----------------------------------------------------------------------------//
function Main()
DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
FROM 5, 5 TO 20, 50
ACTIVATE DIALOG oDlg CENTERED on init INICIO()
return nil
static function INICIO
@ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
OF oDlg SIZE 160, 90 && design
@ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
ACTION MsgInfo( "Hello world!" )
return nil
//----------------------------------------------------------------------------//
Gracias,
Rossine.
Posted: Tue Feb 13, 2007 8:22 pm
by karinha
// Dinamically building a folder ontop of a Dinamic DialogBox
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
LOCAL oDlg, oFld
DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
FROM 5, 5 TO 20, 50
ACTIVATE DIALOG oDlg CENTERED on init INICIO( oDlg, oFld )
return nil
static function INICIO( oDlg, oFld )
@ 0.5, 1 FOLDER oFld PROMPT "&Primeiro", "&Segundo", "&Terceiro" ;
OF oDlg SIZE 160, 90 && design
@ 1, 1 BUTTON "&Hello" SIZE 60,16 OF oFld:aDialogs[ 1 ] ;
ACTION MsgInfo( "Hello world!" )
return nil
Posted: Wed Feb 14, 2007 10:54 am
by Rossine
Olá João,
Isto não funcionou
Para simular o problema, dentro do fonte FOLDER.PRG no método "INITIATE" coloque um "msgstop( "parando" )",
e você vai ver que ele não é executado.
Agora se voce executrar o programa abaixo, aí funciona.
Code: Select all
// Dinamically building a folder ontop of a Dinamic DialogBox
#include "FiveWin.ch"
static oDlg, oFld
//----------------------------------------------------------------------------//
function Main()
DEFINE DIALOG oDlg TITLE "FiveWin Dynamic folders" ;
FROM 5, 5 TO 20, 50
@ 0.5, 1 FOLDER oFld PROMPT "&xBase", "&And OOP", "&Power" ;
OF oDlg SIZE 160, 90 && design
@ 1, 1 BUTTON "&Hello" OF oFld:aDialogs[ 1 ] ;
ACTION MsgInfo( "Hello world!" )
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
Obrigado,
Rossine.
Posted: Wed Feb 14, 2007 11:11 am
by Antonio Linares
Rossine,
El método Initiate() sólo se ejecuta para controles redefinidos ó para controles que se crean antes de activar el diálogo. En tu ejemplo, el diálogo ya está creado, por eso no se llama a initiate().
Para que necesitas llamar a Initiate() ?
Posted: Sat Feb 17, 2007 1:53 pm
by Rossine
Olá Antonio,
O problema é que eu estava fazendo chamada a certas funções dentro do método "initiate", mas fiz as mudanças necessárias e funcionou 100%
Code: Select all
METHOD New( nTop, nLeft, aPrompts, aDialogs, oWnd, nOption, nClrFore,;
nClrBack, lPixel, lDesign, nWidth, nHeight, cMsg, lAllWidth,;
oFont, cMultline, aBitmaps ) CLASS TFolder && cMultline, aBitmaps = by Rossine
...
::Register()
if ! Empty( oWnd:hWnd )
#ifdef __CLIPPER__
::Create()
#else
::Create( "SysTabControl32" )
if ! ::aBitmaps == nil && by Rossine && 15/02/07
::SetImageList() && by Rossine && 15/02/07
endif && by Rossine && 15/02/07
::SetPrompts( ::aPrompts )
#endif
if oFont != nil
::SetFont( oFont )
elseif oWnd != nil .and. oWnd:oFont != nil
::SetFont( oWnd:oFont )
else
::GetFont()
endif
oWnd:AddControl( Self )
else
oWnd:DefControl( Self )
endif
for n = 1 to Len( ::aDialogs )
DEFINE DIALOG oDlg OF Self STYLE WS_CHILD ;
FROM 0, 0 TO ::nHeight() - ::nFdHeight - 5, ::nWidth() - 6 PIXEL ;
FONT Self:oFont color nClrFore, nClrBack
::aDialogs[ n ] = oDlg
oDlg:cVarName = "Page" + AllTrim( Str( n ) )
next
if ! Empty( oWnd:hWnd )
::Default()
endif
if lDesign
::CheckDots()
endif
SetWndDefault( oWnd )
::AdjustRect() && 15/02/07 && by Rossine
return Self
Code: Select all
METHOD Initiate( hDlg ) CLASS TFolder
local n, oBmp := { }
local aRect
Super:Initiate( hDlg )
::Default()
#ifndef __CLIPPER__
* if ! ::aBitmaps == nil && by Rossine
* ::SetImageList() && by Rossine
* endif && by Rossine
* ::SetPrompts( ::aPrompts )
* ::AdjustRect() && by Rossine
#else
for n = 1 to Len( ::aDialogs )
#ifdef __CLIPPER__
::aDialogs[ n ]:SetSize( ::nWidth() - 6,;
::nHeight() - ::nFdHeight - 5 )
#else
::aDialogs[ n ]:SetSize( ::nWidth() - 5,;
::nHeight() - ::nFdHeight - 4 )
#endif
next
#endif
return nil
Gracias,
Rossine.