FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Posible mejora para btnBmp
Posts: 1516
Joined: Thu May 27, 2010 02:06 PM
Posible mejora para btnBmp
Posted: Thu Jun 13, 2013 07:26 AM
Es una mejora menor para el metodo cGenprg():
Code (fw): Select all Collapse
METHOD New( )
.......

//  DEFAULT cVarName := "oBtnBmp" + ::GetCtrlIndex()
    ::cVarName = "oBtnBmp" + ::GetCtrlIndex()    //cVarName  ----- por añadir como parametro

   if lDesign
......

METHOD cGenPRG( lDlgUnits ) CLASS TBtnBmp
   local nFactorX, nFactorY
   local cTop, cLeft, cWidth, cHeight
   local cPrg := ""

     DEFAULT lDlgUnits := .F.

  IF  ::oWnd:IsKindOf( "TBAR" )

      cPrg += CRLF + CRLF + "   DEFINE BTNBMP OF oBar " + ;
              'ACTION MsgInfo( "Not defined yet" )'

  ELSE

   nFactorX = If( lDlgUnits, 4 / nLoWord( GetDlgBaseUnits() ), 1 )
   nFactorY = If( lDlgUnits, 8 / nHiWord( GetDlgBaseUnits() ), 1 )

   ::CoorsUpdate()

   cTop    = LTrim( Str( Int( ::nTop    * nFactorX ) ) )
   cLeft   = LTrim( Str( Int( ::nLeft   * nFactorY ) ) )
   cWidth  = LTrim( Str( Int( ::nWidth  * nFactorY ) ) )
   cHeight = LTrim( Str( Int( ::nHeight * nFactorX ) ) )

     cPrg += CRLF + "   @ " + cTop + ", " + cLeft + ;
           ' BTNBMP '+ ::cVarName + ' PROMPT "' + ::cCaption + '" SIZE ' + ;
           cWidth + ", " + cHeight + ;
           " 2007 RESOURCE 'okon' PIXEL OF oWnd ;" + CRLF + ;
           '      ACTION MsgInfo( "Not defined yet!" )' + CRLF

  endif

return cPrg

Continue the discussion