xBrowse – memofields

Re: xBrowse – memofields

Postby frose » Sat Nov 27, 2010 6:14 pm

Oh yes, the result can look like:
Image
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: xBrowse – memofields

Postby James Bott » Sun Nov 28, 2010 2:07 am

Frank,

Hey, that looks great! Will you show us how you did the codeblock for the colors?

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: xBrowse – memofields

Postby Otto » Sun Nov 28, 2010 7:59 am

Hello James, hello Frank,
thank you.
I will try to use bold font for the first row of a "database" record.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: xBrowse – memofields

Postby frose » Sun Nov 28, 2010 4:05 pm

James,

here is a working sample:
Code: Select all  Expand view
#include "fivewin.ch"
#include "xbrowse.ch"

#define COLOR_ORANGE RGB( 255, 204, 135 )
#define COLOR_BLUE   RGB( 156, 169, 223 )

FUNCTION main()
   LOCAL oWnd
   LOCAL oBrw
   LOCAL oCol
   LOCAL aDaten := {}
   // Fill array
   AAdd( aDaten, { 01, "One  ", "Freilebende        ", "Nun sind           ", "Wenn ich mit Xao im ", "Anfhren sollte man  ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 02, "One  ", "Gummib„rchen       ", "Gummib„rchen       ", "Kino bin, red ich   ", "auch noch: manche    ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 03, "One  ", "gibt es nicht. Man ", "weder wabbelig     ", "ihm so lange ein,   ", "m”gen die Grnen am  ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 04, "One  ", "kauft sie in       ", "noch z„h; sie      ", "daá das die besten  ", "liebsten, manche     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 05, "One  ", "Packungen an der   ", "stehen genau an der", "sind, bis er sie    ", "die Gelben. Ich mag  ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 06, "One  ", "Kinokasse. Dieser  ", "Grenze. Auch das   ", "alle isst. Sie      ", "am liebsten die      ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 07, "One  ", "Kauf ist der Beginn", "macht sie spannend.", "schmecken           ", "Roten. Sie glhen    ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 08, "One  ", "einer fast         ", "Gummib„rchen sind  ", "scheusslich und     ", "richtig rot, und     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 09, "One  ", "erotischen und sehr", "auf eine           ", "fhlen sich         ", "ihr                  ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 10, "One  ", "ambivalenten       ", "aufreizende Art    ", "scheusslich an.     ", "Himbeergeschmack     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 11, "One  ", "Beziehung          ", "weich. Und da sie  ", "Dagegen das sch”ne, ", "f„hrt wie Napalm     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 12, "One  ", "Gummib„rchen-      ", "weich sind, kann   ", "herk”mmliche Gu     ", "ber die             ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 13, "One  ", "Mensch.            ", "man sie auch       ", "                    ", "Geschmacksknospen.   ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 14, "One  ", "                   ", "ziehen. Ich mache  ", "                    ", "Eine meiner          ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 15, "One  ", "                   ", "das sehr gerne. Ich", "                    ", "Lieblingsphantasien  ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 16, "One  ", "                   ", "sitze im dunklen   ", "                    ", ", wo es um           ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 17, "One  ", "                   ", "Kino und ziehe     ", "                    ", "Gummib„rc            ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 18, "Two  ", "This               ", "Is a               ", "short               ", "text                 ", { CLR_BLACK, COLOR_BLUE   } } )
   AAdd( aDaten, { 19, "Four ", "In dichter und     ", "Nie wieder         ", "Schon zu  Hause     ", "Und wieder und       ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 20, "Four ", "geraffter Form     ", "Gummib„rchen, denke", "beunruhigen  mich   ", "wieder geht es mir   ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 21, "Four ", "spiegelt sich im   ", "ich jedesmal. In   ", "wieder Gerchte     ", "durch den Kopf:      ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 22, "Four ", "Verh„ltnis zum     ", "der Zwischenzeit   ", "ber einen          ", "Gummib„rchen sind    ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 23, "Four ", "Gummib„rchen eine  ", "l„chle ich dann    ", "Marktvorstoá der    ", "Spitze.              ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 24, "Four ", "menschliche Love-  ", "ber den           ", "Japaner mit         ", "                     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 25, "Four ", "Affair wider.      ", "Absolutheitsanspruc", "Gummireis oder      ", "                     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 26, "Four ", "                   ", "h den diese Momente", "Gummischweinen.     ", "                     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 27, "Four ", "                   ", "erheben.           ", "                    ", "                     ", { CLR_BLACK, COLOR_ORANGE } } )
   AAdd( aDaten, { 28, "Five ", "This               ", "Is a               ", "short               ", "text                 ", { CLR_BLACK, COLOR_BLUE   } } )
   AAdd( aDaten, { 29, "Six  ", "Empty              ", "                   ", "                    ", "                     ", { CLR_BLACK, COLOR_ORANGE } })
   AAdd( aDaten, { 30, "Seven", "Here is a little   ", "                   ", "                    ", "                     ", { CLR_BLACK, COLOR_BLUE   } } )
   AAdd( aDaten, { 31, "Seven", "bit more text      ", "                   ", "                    ", "                     ", { CLR_BLACK, COLOR_BLUE   } } )
   //
   AEval( aDaten,    { | x, n | aDaten[ n , 3 ] := HB_OemToAnsi( x[ 3 ] ), ;
                                aDaten[ n , 4 ] := HB_OemToAnsi( x[ 4 ] ), ;
                                aDaten[ n , 5 ] := HB_OemToAnsi( x[ 5 ] ), ;
                                aDaten[ n , 6 ] := HB_OemToAnsi( x[ 6 ] ) } )

   DEFINE WINDOW oWnd TITLE "xBrowse with alternating row color"

   oBrw := TXBrowse():New( oWnd )
   // Column 1
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "Recno"
   oCol:nArrayCol := 1
   // Column 2
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "Name"
   oCol:nArrayCol := 2
   oCol:bStrData  := { || IIf( oBrw:nArrayAt == 1, ;
                          aDaten[ oBrw:nArrayAt, 2 ], ;
                          IIf( Upper( RTrim( aDaten[ oBrw:nArrayAt, 2 ] ) ) == Upper( RTrim( aDaten[ oBrw:nArrayAt - 1, 2 ] ) ), ;
                          "", ;
                          aDaten[ oBrw:nArrayAt, 2 ] ) ) }
   // Column 3
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "P01"
   oCol:nArrayCol := 3
   // Column 4
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "P02"
   oCol:nArrayCol := 4
   // Column 5
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "P03"
   oCol:nArrayCol := 5
   // Column 6
   oCol           := oBrw:AddCol()
   oCol:cHeader   := "P04"
   oCol:nArrayCol := 6
   
   // set color
   oBrw:bClrStd := { || aDaten[ oBrw:nArrayAt, 7 ] }
   
   oBrw:nRowDividerStyle = LINESTYLE_NOLINES
   oBrw:nColDividerStyle = LINESTYLE_NOLINES

   oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW

   oBrw:SetArray( aDaten )

   oBrw:lRecordSelector := .T.

   oBrw:CreateFromCode()

   oWnd:oClient := oBrw
   
   ACTIVATE WINDOW oWnd

RETURN NIL
 


For the first approach, I've defined a new 'bSkip', trying to set the colors dynamically, but it doesn't work correctly! Just try it and you'll see what I mean:
Code: Select all  Expand view
  oBrw:bSkip  := { | nSkip, nOld | ;
                    IIf( nSkip == nil, nSkip := 1, ), ;
                    nOld := oBrw:nArrayAt, ;
                    oBrw:nArrayAt += nSkip, ;
                    oBrw:nArrayAt := Min( Max( oBrw:nArrayAt, 1 ), Len( oBrw:aArrayData ) ), ;
                    Eval( oBrw:bOnSkip, oBrw ), ;
                    lClrFlag := IIf( aDaten[ nOld, 2 ] == aDaten[ oBrw:nArrayAt, 2 ], lClrFlag, !lClrFlag ), ;
                    oBrw:nArrayAt - nOld }

   oBrw:bClrStd := { || IIf( lClrFlag, { CLR_BLACK, COLOR_ORANGE }, { CLR_BLACK, COLOR_BLUE } ) }
 

Perhaps you or someone else have a good idea to determine the color of the rows with 'bSkip'?
Windows 11 Pro 22H2 22621.1848
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Harbour 3.2.0dev (r2008190002)
FWH 23.10 x86
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests