Page 1 of 1

Modificaciones a RBDESIGN.PRG para incluir tooltip

Posted: Mon Feb 20, 2012 2:08 pm
by wmormar
Sin mas preambulo,

Code: Select all

function RibbonButtonOptions( nRow, nCol, oButton )
   
   ....
   
   MENU oMenu POPUP
      MENUITEM "Edit prompt..." ACTION EditButtonLabel( oButton )

      MENUITEM "Edit tooltip..." ACTION EditButtonTooltip( oButton )
      
      MENUITEM "Select bitmap..." ACTION ( oButton:LoadBitmaps( cGetFile( "*.bmp" ) ), oButton:Refresh() )
      
   ...

return nil   

......

function EditButtonTooltip( oButton )

   local oDlg, oGet, cTooltip := PadR( oButton:cTooltip, 100 ), cOldTooltip := oButton:cTooltip
   
   if empty(cTooltip)
      cTooltip := ""
   endif
   
   DEFINE DIALOG oDlg TITLE "Edit Button Tooltip"

   @ 1.8, 4 GET oGet VAR cTooltip MEMO SIZE 100, 24 ;
      ON CHANGE ( oButton:cTooltip := AllTrim( oGet:GetText() ), oButton:Refresh() )
      
   @ 3, 6 BUTTON "&Ok" OF oDlg ACTION ( oButton:cTooltip := AllTrim( oGet:GetText() ), oButton:Refresh(), oDlg:End() )

   @ 3, 14 BUTTON "&Cancel" OF oDlg ACTION ( oButton:cTooltip := cOldTooltip, oButton:Refresh(), oDlg:End() )
   
   oGet:bGotFocus := {|o| o:SelectAll()}
   
   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//

 

Re: Modificaciones a RBDESIGN.PRG para incluir tooltip

Posted: Mon Feb 20, 2012 6:13 pm
by wmormar
Se me olvido la modificacion a la clase TRBN,

Code: Select all

METHOD cGenPrg() CLASS TRBtn

   ........
   ........

   if ::oPopup != nil .and. IsWindow( ::oPopup:hMenu )
      cCode += " MENU BuildMenu" + AllTrim( Str( nAt ) ) + "_" + AllTrim( Str( nGroup ) ) + "_" + AllTrim( Str( nTab ) ) + "()" 
   endif

   if ! Empty( ::cTooltip )
      cCode += ' TOOLTIP "' + AllTrim( ::cTooltip ) + '"'
   endif
   
   cCode += CRLF                  
   
return cCode   

//----------------------------------------------------------------------------//
 

Re: Modificaciones a RBDESIGN.PRG para incluir tooltip

Posted: Mon Feb 20, 2012 6:24 pm
by Antonio Linares

Re: Modificaciones a RBDESIGN.PRG para incluir tooltip

Posted: Tue Feb 21, 2012 3:21 am
by wmormar
Mil disculpas por el repost, pero no lo habia visto, para la otra vere el foro antes de reinventar la rueda, jjejjejjejje

Re: Modificaciones a RBDESIGN.PRG para incluir tooltip

Posted: Tue Feb 21, 2012 8:53 am
by Antonio Linares
No hay problema William, era para unificar ambas conversaciones :-)