FW 16.11: XBrowse multi-font/colored cells

FW 16.11: XBrowse multi-font/colored cells

Postby nageswaragunupudi » Mon Nov 28, 2016 8:48 am

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 view
/*
* 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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby Antonio Linares » Mon Nov 28, 2016 10:09 am

very nice and useful :-)
regards, saludos

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

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

Postby joseluisysturiz » Mon Nov 28, 2016 2:08 pm

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
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

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

Postby TimStone » Mon Nov 28, 2016 6:23 pm

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
TimStone
 
Posts: 2904
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

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

Postby nageswaragunupudi » Mon Nov 28, 2016 6:37 pm

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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby TimStone » Mon Nov 28, 2016 6:59 pm

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
TimStone
 
Posts: 2904
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

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

Postby nageswaragunupudi » Tue Nov 29, 2016 3:11 pm

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
nageswaragunupudi
 
Posts: 10248
Joined: Sun Nov 19, 2006 5:22 am
Location: India

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

Postby joseluisysturiz » Tue Nov 29, 2016 4:25 pm

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!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests