Page 1 of 1

Ajustando el texto en la VISTA PREVIA FWH26.03

Posted: Thu May 21, 2026 5:40 pm
by karinha

Master Antônio, in the Fwh2603 PREVIEW, at the TOP OF THE PREVIEW, where it says: Arquivo(File)Página(/Page), which class and line should I modify so that the text is correctly formatted?

Maestro Antônio, en la VISTA PREVIA Fwh2603, en la PARTE SUPERIOR DE LA VISTA PREVIA, donde dice: Archivo/Página, ¿qué clase y línea debo modificar para que el texto tenga el formato correcto?

https://imgur.com/DMVEaIY

Image

Gracias, tks.

Regards, saludos.


Re: Ajustando el texto en la VISTA PREVIA FWH26.03

Posted: Fri May 22, 2026 1:38 pm
by mterraz

Buen dia, espero te sirva de ayuda:

rpreview.prg
El "Archivo" es el título de la ventana, que toma el valor de ::oDevice:cDocument (lo que pasaste en PRINT NAME "..."). Eso se hace en BuildWindow(), líneas 444-446:
444 if ::oDevice != nil
445 cTitle = ::oDevice:cDocument
446 endif
El "Página X / Y" que ves en la barra de botones de la vista previa se arma en BuildButtonBar(). Está en dos lugares, según el estilo del visor:
Estilo 2007 o superior (líneas 554-560 de rpreview.prg):
554 if nStyle >= 2007
555 oBar:bPainted = { || oBar:Say( nRow, nCol, "Factor:",,, ::oFont, .T., .T. ),;
556 oBar:Say( nRow, nCol+100, ::cPageNum + " " + ;
557 LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
558 LTrim( Str( Len( ::oDevice:aMeta ) ) ),,, ::oFont, .T., .T. ) }
559
560 endif
Estilo clásico (anterior a 2007) (líneas 574-580):
574 if nStyle < 2007
575 @ nRow, nCol + 100 SAY ::oPage PROMPT FWString( "Page number:" ) + ;
576 LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
577 LTrim( Str( Len( ::oDevice:aMeta ) ) ) ;
578 SIZE 180, 15 PIXEL OF ::oBar FONT ::oFont
579 ::oPage:lTransparent = .T.
580 endif
Y al cambiar de página, el texto se reescribe en tres métodos más:

GoPage() → líneas 813-816
NextPage() → líneas 924-927
PrevPage() → líneas 960-963

Todos usan el mismo patrón: FWString("Page number:") + LTrim(Str(::nPage,4,0)) + " / " + LTrim(Str(Len(::oDevice:aMeta))).
Clase y línea para modificar
Clase: TPreview (archivo rpreview.prg)
Método principal: BuildButtonBar() — líneas 556-558 (estilo 2007+) y 575-577 (estilo clásico).
Métodos secundarios a sincronizar: GoPage (líneas 814-815), NextPage (925-926) y PrevPage (961-962).
Si solo cambiás BuildButtonBar el texto se verá bien al abrir la vista previa, pero al pasar de página va a volver al formato original — por eso hay que tocar los tres métodos de navegación también.
Sobre el "formato correcto"
Pero necesito que me aclares qué es lo que querés conseguir, porque "formato correcto" puede ser cualquiera de estas cosas:

Querés cambiar el texto a español ("Página número: 3 / 10" o "Página 3 de 10"): hay que retocar las líneas indicadas y, si usás FWString(), lo correcto es agregar la traducción en tu archivo de idioma, no tocar el .prg.
El texto se ve cortado (por ejemplo solo entran "Página número: 3 /" y se corta el total): es el SIZE 180, 15 de la línea 578 — habría que ampliarlo.
Los acentos salen mal ("P�gina"): es problema de codificación/fuente, no del literal.
Querés cambiar el separador ("3/10" en vez de "3 / 10", o "3 de 10"): retocar el " / " en las líneas 557, 576, 815, 926, 962.
El texto se superpone con otro control de la barra: hay que mover el nCol + 100 (línea 575) o el nCol+100 de la línea 556.

Esta en C:\FWH26\source\classes

saludos Mariano


Re: Ajustando el texto en la VISTA PREVIA FWH26.03

Posted: Fri May 22, 2026 3:49 pm
by karinha

Super many thanks Mariano Ferraz.

RPREVIEW.PRG

Code: Select all | Expand

METHOD BuildMenu() CLASS TPreview

   LOCAL nFor, oMenu, oMItem

   // PUBLIC nLanguage  // en el MENU PRINCIPAL.

   ::aFactor := Array( 9 )

   MENU oMenu

  oMenu:l2007 := ( nStyle == 2007 )
  oMenu:l2010 := ( nStyle == 2010 )

  IF( nLanguage != 4 ) // AQUI

     MENUITEM FWString( "&File" ) // Original - Error.

  ELSE // Portuguese es asi:

     MENUITEM + SPACE(04) + "&Arquivo   " // MODIFICADO EM: 22/05/2026 - Joao

  ENDIF

  MENU
     MENUITEM oMItem PROMPT FWString( "&Print" ) ACTION ( oMenuItem, If( ValType( ::bPrint ) == 'B', Eval( ::bPrint, Self ), ::PrintPage() ) ) ;
        MESSAGE FWString( "Print actual page" )

     oMItem:hBitmap = FWBitmap( "printer" )

     SEPARATOR

     MENUITEM oMItem PROMPT FWString( "&Exit" ) ACTION ( oMenuItem, ::oWnd:End() ) ;
        MESSAGE FWString( "Exit from preview" )

     oMItem:hBitmap = FWBitmap( "Exit2" )

  ENDMENU

  IF( nLanguage != 4 ) // AQUI

     MENUITEM FWString( "&Page" ) // Original - Error.

  ELSE

     MENUITEM + SPACE(02) + "&Página   " 

  ENDIF

  MENU
     MENUITEM oMItem PROMPT FWString( "&First" ) ACTION ( oMenuItem, ::TopPage() ) ;
        MESSAGE FWString( "Go to first page" )

     oMItem:hBitmap = FWBitmap( "top2" )

     MENUITEM oMItem PROMPT FWString( "&Previous" ) ACTION ( oMenuItem, ::PrevPage() ) ;
        MESSAGE FWString( "Go to previous page" )

     oMItem:hBitmap = FWBitmap( "previous2" )

     MENUITEM oMItem PROMPT FWString( "&Next" ) ACTION ( oMenuItem, ::NextPage() ) ;
        MESSAGE FWString( "Go to next page" )

     oMItem:hBitmap = FWBitmap( "next2" )

     MENUITEM oMItem PROMPT FWString( "&Last" ) ACTION ( oMenuItem, ::BottomPage() ) ;
        MESSAGE FWString( "Go to last page" )

     oMItem:hBitmap = FWBitmap( "bottom2" )

     SEPARATOR

     MENUITEM oMItem PROMPT ::oMenuZoom PROMPT FWString( "&Zoom" ) ACTION ( oMenuItem, ::Zoom( .T. ) ) ;
        MESSAGE FWString( "Page zoom" )

     oMItem:hBitmap = FWBitmap( "zoom2" )

     MENUITEM oMItem PROMPT ::oMenuUnZoom PROMPT FWString( "&Normal" ) ACTION ( oMenuItem, ::Zoom( .T. ) ) ;
        MESSAGE FWString( "Page unzoom" )

     oMItem:hBitmap = FWBitmap( "onepage2" )

     MENUITEM FWString( "&Factor" ) MESSAGE FWString( "Zoom factor" )
     MENU
        for nFor := 1 to Len( ::aFactor )
           MENUITEM ::aFactor[ nFor ]                  ;
              PROMPT "&" + LTrim( Str( nFor ) )        ;
              MESSAGE FWString( "Factor" ) + " " + LTrim( Str( nFor ) ) ;
              ACTION If( ::oFactor == nil, nil, ( ::oFactor:Set( oMenuItem:nHelpId ),;
                       Eval( ::oFactor:bChange ) ) )

        next
     ENDMENU

     SEPARATOR

     MENUITEM ::oMenuTwoPages PROMPT FWString( "&Two pages" ) ACTION ( oMenuItem, ::TwoPages( .T. ) ) ;
        MESSAGE FWString( "Preview on two pages" )

     ::oMenuTwoPages:hBitmap = FWBitmap( "TwoPages2" )
     ::oMenuTwoPages:bWhen   = {|| Len( ::oDevice:aMeta ) > 1 }

     MENUITEM ::oMenuOnePage PROMPT FWString( "One &page" ) ACTION ( oMenuItem, ::TwoPages(.T.) ) ;
        MESSAGE FWString( "Preview on one page" )

     ::oMenuOnePage:hBitmap = FWBitmap( "onepage2" )

  ENDMENU

   ENDMENU

   ::oMenuUnZoom:Disable()
   ::oMenuOnePage:Disable()

return oMenu

Regards, saludos.


Re: Ajustando el texto en la VISTA PREVIA FWH26.03

Posted: Fri May 22, 2026 5:33 pm
by karinha

Esto es mejor y más profesional. Me gustó mucho.

Code: Select all | Expand

         MENUITEM "&Arquivo" RESOURCE "IMP16"

Code: Select all | Expand

         MENUITEM "&Página" RESOURCE "IMP16"

Regards, saludos.