FW 16.11: XBrowse multi-font/colored cells

Post Reply
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

FW 16.11: XBrowse multi-font/colored cells

Post by nageswaragunupudi »

Different lines, separated by CRLF, in the data of a cell can be painted with different fonts and colors by using oCol:aClrText and oCol:aDataFont

Image

Sample: fwh\samples\xbfntclr.prg

Code: Select all | Expand

/*
* XBrowse
* Different lines in different fonts and colors
*
*/


#include "fivewin.ch"

REQUEST DBFCDX

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

function Main()

   field STATE,CODE
   local oDlg, oFont, oBrw
   local aFont1[ 2 ], aFont2[ 4 ]

   USE STATES NEW SHARED VIA "DBFCDX"
   INDEX ON CODE TAG CODE TO TMP MEMORY
   SET ORDER TO TAG CODE
   USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
   SET RELATION TO STATE INTO STATES
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14

   DEFINE FONT aFont1[ 1 ] NAME "VIVALDI" SIZE 0,-30
   DEFINE FONT aFont1[ 2 ] NAME "Verdana" SIZE 0,-20

   DEFINE FONT aFont2[ 1 ] NAME "TIMES NEW ROMAN" SIZE 0,-18
   DEFINE FONT aFont2[ 2 ] NAME "TAHOMA" SIZE 0,-16 BOLD
   DEFINE FONT aFont2[ 4 ] NAME "TAHOMA" SIZE 0,-16 ITALIC BOLD

   DEFINE DIALOG oDlg SIZE 700,800 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FWH16.11: XBROWSE Multiple Fonts and Colors"

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg DATASOURCE "CUST" ;
      COLUMNS "TRIM(FIRST) + CHR(13)+CHR(10) + LAST", ;
              "TRIM(STREET) + CHR(13)+CHR(10) + TRIM(CITY) +CHR(13)+CHR(10) + TRIM(ZIP) + CHR(13)+CHR(10) + TRIM(STATES->NAME)", ;
              "TRIM(FIRST) + CHR(13)+CHR(10)+TRIM(LAST)" ;
      HEADERS "NAME", "ADDRESS", "CUSTOMER" ;
      JUSTIFY AL_CENTER, AL_CENTER, AL_CENTER ;
      LINES NOBORDER

   WITH OBJECT oBrw
      :nRowHeight    := 100
      :nWidths       := { 200, 250, 150 }
      :nHeadStrAligns:= AL_CENTER
      :nStretchCol   := 2
      :lFitGridHeight:= .t.

      WITH OBJECT :name
         :aDataFont  := aFont1
         :aClrText   := { CLR_HBLUE, CLR_HRED }
      END

      WITH OBJECT :address
         :aDataFont  := aFont2
         :aClrText   := { nil, CLR_HRED, nil, CLR_GREEN }
      END

      WITH OBJECT :aCols[ 3 ]
         :nDataStrAlign := AL_LEFT + AL_BOTTOM
         :bStrImage     := { || "c:\fwh\bitmaps\olga1.jpg" }
         :aImgRect      := { nil, 0.3, 0.7, nil, "CIRCLE" }
      END
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

   RELEASE FONT oFont
   AEval( aFont1, { |o| If( o == nil,,o:End() ) } )
   AEval( aFont2, { |o| If( o == nil,,o:End() ) } )


return nil

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

This sample also shows how to compose text and image in the same cell using text alignment and DATA aImgRect
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by Antonio Linares »

very nice and useful :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by joseluisysturiz »

Saludos Mr. NAO, cuando puedas prodria hecharle un ojo a este tema,? saludos, gracias... :shock:

viewtopic.php?f=6&t=33221
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
TimStone
Posts: 2955
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by TimStone »

At one time, in my distant memory, it was possible to have a header with grouping in a browse. On some columns, there might just be the normal title, but it was possible to group several columns under a title. For example:

| | Section 1 |
Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | Col 6

Can we do this in xBrowse currently ? Sorry ... not seeing it in the docs ...

Sorry ... it lines up in preview, but not on forum. Col 3, 4, 5 are under the group heading Section 1
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by nageswaragunupudi »

Syntax:
oBrw:SetGroupHeader( cGrpHdr, [nFrom], [nUpto], [oFont], [nAlign] )

In the above case:

oBrw:SetGroupHeader( "Section 1", 3, 5 )
Regards

G. N. Rao.
Hyderabad, India
User avatar
TimStone
Posts: 2955
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by TimStone »

Thank you.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by nageswaragunupudi »

joseluisysturiz wrote:Saludos Mr. NAO, cuando puedas prodria hecharle un ojo a este tema,? saludos, gracias... :shock:

viewtopic.php?f=6&t=33221

Yes, I will
Regards

G. N. Rao.
Hyderabad, India
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: FW 16.11: XBrowse multi-font/colored cells

Post by joseluisysturiz »

nageswaragunupudi wrote:
joseluisysturiz wrote:Saludos Mr. NAO, cuando puedas prodria hecharle un ojo a este tema,? saludos, gracias... :shock:

viewtopic.php?f=6&t=33221

Yes, I will


Muchas gracias... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
Post Reply