How to change toolbar's bitmaps in rpreview?

How to change toolbar's bitmaps in rpreview?

Postby richard-service » Thu Nov 10, 2016 2:52 am

HI
I want to change bitmaps when preview report toolbar.
I look rpreview.prg not include prev32.dll, so how to change bitmaps and add in my preview.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change toolbar's bitmaps in rpreview?

Postby Antonio Linares » Thu Nov 10, 2016 7:22 pm

Richard,

You have to review and modify FWH function FWBitmap()
regards, saludos

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

Re: How to change toolbar's bitmaps in rpreview?

Postby richard-service » Fri Nov 11, 2016 4:10 am

Antonio Linares wrote:Richard,

You have to review and modify FWH function FWBitmap()


Yes, I found Bitmaps.c source code. How to Bmp convert to these code?
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change toolbar's bitmaps in rpreview?

Postby cnavarro » Fri Nov 11, 2016 4:27 am

Look samples folder

Bmptohex.prg and Bmptoc.prg
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: How to change toolbar's bitmaps in rpreview?

Postby nageswaragunupudi » Fri Nov 11, 2016 7:18 am

You can use the function
Code: Select all  Expand view

RPrevUsrBtns( bUserBtns, nBarStyle, aSize )
 

to customize most (not fully) the buttonbar of preview. You can have your own buttons, replace some bitmaps, have your own style and size of the bar. Even you can have your Chinese prompts for the buttons.

Actually this is the purpose of this function. Once you set this at the beginning of your project, all your previews through out your application will have this look.

This is only an example of how to do. You can use this as a sample and customize to your requirements.
Code: Select all  Expand view
#include "fivewin.ch"

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

function Main()

   local oPrn, oFont
   local nOldClr

   FW_SetUnicode( .t. )

   RPrevUserBtns( { |oPreview, oBar| MyPreviewBar( oPreview, oBar ) }, 2007, { 64,64 } )
   TPreview():lListViewHide := .t.

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-30 BOLD OF oPrn

   PAGE
      nOldClr  := SetBkColor( oPrn:hDCOut, CLR_BLACK )
      oPrn:Say( 500, 200, "This is Reverse Text", oFont, 5000, CLR_WHITE, 2 )
      SetBkColor( nOldClr )
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil

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

function MyPreviewBar( oPreview, oBar )

   local nBtns    := Len( oBar:aControls )


   WITH OBJECT oBar:aControls[ 1 ]
      :SetImages( "\fwh\bitmaps\top.bmp" )
      :cCaption   := "మొదలు"
   END
   WITH OBJECT oBar:aControls[ 2 ]
      :SetImages( "\fwh\bitmaps\prev.bmp" )
      :cCaption   := "ముందు"
   END
   WITH OBJECT oBar:aControls[ 3 ]
      :SetImages( "\fwh\bitmaps\next.bmp" )
      :cCaption   := "పిదప"
   END
   WITH OBJECT oBar:aControls[ 4 ]
      :SetImages( "\fwh\bitmaps\bottom.bmp" )
      :cCaption   := "చివర"
   END


   WITH OBJECT oBar:aControls[ nBtns ]
      :SetImages( "\fwh\bitmaps\print32.bmp" )
      :cCaption   := "ముద్రించు"
   END


   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\32x32\floppy.bmp" ;
      PROMPT "భద్రము" ACTION MsgInfo( "MySave" )

   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\sendmail.bmp" ;
      PROMPT "జాబు" ACTION MsgInfo( "MySave" )

return .f.
 


Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: How to change toolbar's bitmaps in rpreview?

Postby richard-service » Fri Nov 11, 2016 11:50 am

Dear Cristobal Navarro and Mr Rao

Now is working.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change toolbar's bitmaps in rpreview?

Postby richard-service » Thu Dec 15, 2016 12:03 pm

nageswaragunupudi wrote:You can use the function
Code: Select all  Expand view

RPrevUsrBtns( bUserBtns, nBarStyle, aSize )
 

to customize most (not fully) the buttonbar of preview. You can have your own buttons, replace some bitmaps, have your own style and size of the bar. Even you can have your Chinese prompts for the buttons.

Actually this is the purpose of this function. Once you set this at the beginning of your project, all your previews through out your application will have this look.

This is only an example of how to do. You can use this as a sample and customize to your requirements.
Code: Select all  Expand view
#include "fivewin.ch"

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

function Main()

   local oPrn, oFont
   local nOldClr

   FW_SetUnicode( .t. )

   RPrevUserBtns( { |oPreview, oBar| MyPreviewBar( oPreview, oBar ) }, 2007, { 64,64 } )
   TPreview():lListViewHide := .t.

   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "ARIAL" SIZE 0,-30 BOLD OF oPrn

   PAGE
      nOldClr  := SetBkColor( oPrn:hDCOut, CLR_BLACK )
      oPrn:Say( 500, 200, "This is Reverse Text", oFont, 5000, CLR_WHITE, 2 )
      SetBkColor( nOldClr )
   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont

return nil

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

function MyPreviewBar( oPreview, oBar )

   local nBtns    := Len( oBar:aControls )


   WITH OBJECT oBar:aControls[ 1 ]
      :SetImages( "\fwh\bitmaps\top.bmp" )
      :cCaption   := "మొదలు"
   END
   WITH OBJECT oBar:aControls[ 2 ]
      :SetImages( "\fwh\bitmaps\prev.bmp" )
      :cCaption   := "ముందు"
   END
   WITH OBJECT oBar:aControls[ 3 ]
      :SetImages( "\fwh\bitmaps\next.bmp" )
      :cCaption   := "పిదప"
   END
   WITH OBJECT oBar:aControls[ 4 ]
      :SetImages( "\fwh\bitmaps\bottom.bmp" )
      :cCaption   := "చివర"
   END


   WITH OBJECT oBar:aControls[ nBtns ]
      :SetImages( "\fwh\bitmaps\print32.bmp" )
      :cCaption   := "ముద్రించు"
   END


   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\32x32\floppy.bmp" ;
      PROMPT "భద్రము" ACTION MsgInfo( "MySave" )

   DEFINE BUTTON OF oBar FILE "\fwh\bitmaps\sendmail.bmp" ;
      PROMPT "జాబు" ACTION MsgInfo( "MySave" )

return .f.
 


Image


Hi Mr.Rao
I want to change all bitmaps in ToolBar, but appear error "BASE/1132 Bound error: array access"
Code: Select all  Expand view

WITH OBJECT oBar:aControls[ 1 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\DB-First.bmp" )
//         :cCaption := "第一頁"
      END
      WITH OBJECT oBar:aControls[ 2 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\DB-PREV.bmp" )
//         :cCaption := "上一頁"
      END
      WITH OBJECT oBar:aControls[ 3 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\DB-NEXT.bmp" )
//         :cCaption := "下一頁"
      END
      WITH OBJECT oBar:aControls[ 4 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\DB-LAST.bmp" )
//         :cCaption := "最後一頁"
      END
      WITH OBJECT oBar:aControls[ 5 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Zoom.bmp" )
//         :cCaption := "放大"
      END
      WITH OBJECT oBar:aControls[ 6 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\TwoPages.bmp" )
//         :cCaption := "兩頁"
      END
      WITH OBJECT oBar:aControls[ 7 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Printer.bmp" )
//         :cCaption := "列印"
      END
      WITH OBJECT oBar:aControls[ 8 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Save.bmp" )
//         :cCaption := "儲存"
      END
      WITH OBJECT oBar:aControls[ 9 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Export Acrobat.bmp" )
//         :cCaption := "儲存"
      END
      WITH OBJECT oBar:aControls[ 10 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\EMail.bmp" )
//         :cCaption := "儲存"
      END
      WITH OBJECT oBar:aControls[ 11 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Export Word.bmp" )
//         :cCaption := "儲存"
      END
      WITH OBJECT oBar:aControls[ 12 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Export Excel.bmp" )
//         :cCaption := "儲存"
      END
      WITH OBJECT oBar:aControls[ 13 ]
         :SetImages( "System\C5Menu\BMP\ToolBar\Exit.bmp" )
//         :cCaption := "儲存"
      END
 
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: How to change toolbar's bitmaps in rpreview?

Postby nageswaragunupudi » Thu Dec 15, 2016 12:11 pm

By the time this code is executed only 7 buttons are created. We need to add other buttons and actions ourselves. We take over the control of the entire buttonbar
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

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