Ayuda con una classe

Ayuda con una classe

Postby ruben Dario » Mon Mar 09, 2020 3:18 am

Saludos al Forum

Segun este Ejemplo de dicho codigo
s_oClass:AddMethod( "New", @New() )

como lo defino
CLASS TApp01
METHOD EntraDat @EntraDat()


ENDCLASS




Code: Select all  Expand view  RUN

PROCEDURE Main()
   LOCAL oForm := TForm():New()
   ? oForm:ClassName()
   oForm:Show()
   RETURN

FUNCTION TForm()
   STATIC s_oClass
   IF s_oClass == NIL
      s_oClass := HBClass():New( "TFORM" )    // starts a new class definition
      s_oClass:AddData( "cName" )           // define this class objects datas
      s_oClass:AddData( "nTop" )
      s_oClass:AddData( "nLeft" )
      s_oClass:AddData( "nBottom" )
      s_oClass:AddData( "nRight" )
      s_oClass:AddMethod( "New",  @New() )  // define this class objects methods
      s_oClass:AddMethod( "Show", @Show() )
      s_oClass:Create()                     // builds this class
   ENDIF
   RETURN s_oClass:Instance()                  // builds an object of this class

STATIC FUNCTION New()
   LOCAL Self := QSelf()
   ::nTop    := 10
   ::nLeft   := 10
   ::nBottom := 20
   ::nRight  := 40

   RETURN Self
 
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1070
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 98 guests