Antonio, tFolder():Initiate não executa

Antonio, tFolder():Initiate não executa

Postby Rossine » Tue Feb 13, 2007 8:10 pm

Olá Antonio,

Como faço para que o método INITIATE de TFOLDER seja executado no programa abaixo:

Code: Select all  Expand view  RUN
// 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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby karinha » Tue Feb 13, 2007 8:22 pm

// 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
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7855
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Postby Rossine » Wed Feb 14, 2007 10:54 am

Olá João,

Isto não funcionou :cry: 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  Expand view  RUN
// 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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Postby Antonio Linares » Wed Feb 14, 2007 11:11 am

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() ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42150
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Rossine » Sat Feb 17, 2007 1:53 pm

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% :lol:

Code: Select all  Expand view  RUN
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  Expand view  RUN
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.
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 40 guests