Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #11097 > unrolled thread

bBrowser cell color

Started byccyasa.sbassano@gmail.com
First post2017-10-26 16:31 -0700
Last post2017-10-31 09:07 -0700
Articles 12 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-26 16:31 -0700
    Re: bBrowser cell color "Glen Townsley" <coogee.2015@gmail.com> - 2017-10-28 05:55 +1000
      Re: bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-28 05:38 -0700
    Re: bBrowser cell color Martin <Martin@spam.spam> - 2017-10-31 12:08 +0000
      Re: bBrowser cell color "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2017-10-31 13:12 +0100
        Re: bBrowser cell color Martin <Martin@spam.spam> - 2017-10-31 15:06 +0000
      Re: bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-31 06:32 -0700
        Re: bBrowser cell color James Martin <james@northwoodlumber.com> - 2017-10-31 10:33 -0400
          Re: bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-31 07:58 -0700
          Re: bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-31 08:00 -0700
        Re: bBrowser cell color Martin <Martin@spam.spam> - 2017-10-31 15:12 +0000
          Re: bBrowser cell color ccyasa.sbassano@gmail.com - 2017-10-31 09:07 -0700

#11097 — bBrowser cell color

Fromccyasa.sbassano@gmail.com
Date2017-10-26 16:31 -0700
SubjectbBrowser cell color
Message-ID<781533f1-4af6-4b80-b38c-6e98fa1a30d8@googlegroups.com>
Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...

but i think tha must be a better solution.
Regards.

Sebastián

[toc] | [next] | [standalone]


#11100

From"Glen Townsley" <coogee.2015@gmail.com>
Date2017-10-28 05:55 +1000
Message-ID<ot02v6$1344$1@gioia.aioe.org>
In reply to#11097
Sebastian,

There are 2 ways I have approached this.

1. I create a protected variable of the server called aHiLite and fill it 
with the the record numbers of the records I want to highlight. The the 
colorcondition becomes something like

oColorCondition := bColorCondition{    { |oS| oS:IsHiLite() }, ;
                                                                oItemArrServer, 
;
                                                                color{ 
SELF:Owner:nHiLiteR, SELF:Owner:nHiLiteG, SELF:Owner:nHiLiteB }, ;
                                                                   }
I am using a foreground highlight, but you could easily use it for 
background highlights.

2. There is a little known feature of bBrowser that I have just started to 
use in the last month or so. The colorcondition's second parameter need not 
be a server object. So you can use

oColorCondition := bColorCondition{    { |oWindow| 
oWindow:ColourConditions() }, ;
                                                                    SELF, ;
                                                                    , ;
                                                                     }
oB:ColorCondition:Add( oColorCondition )

and call a method of the window. This method can return true/false but it 
can also return an array. The method might look like

METHOD ColourConditions() CLASS QtyAtCompMgtWin
    LOCAL uVal                                AS USUAL                    // 
can be array or false
    LOCAL oS                                AS bArrayServer
    LOCAL oB                                AS scbBrowser
    LOCAL aBGFormula                        AS ARRAY
    LOCAL aFGFormula                        AS ARRAY
    LOCAL oIni                                AS scFabRegistry

    uVal := FALSE

    oB := SELF:oDCbBrowseItems
    oS := oB:Server

    IF PCE_IsFormula( cDesc ) != #NOFORMULA 
// formula
            aBGFormula := { oIni:GetIniString( 'FORMULA', 'MAKE_BG_RED', 
251 ), ;
                                        oIni:GetIniString( 'FORMULA', 
'MAKE_BG_GREEN', 245 ), ;
                                        oIni:GetIniString( 'FORMULA', 
'MAKE_BG_BLUE', 181 ) }
            aFGFormula := { oIni:GetIniString( 'FORMULA', 'MAKE_FG_RED', 
0 ), ;
                                        oIni:GetIniString( 'FORMULA', 
'MAKE_FG_GREEN', 0 ), ;
                                        oIni:GetIniString( 'FORMULA', 
'MAKE_FG_BLUE', 0 ) }
            uVal := ArrayNew( BCS_ITEMS )
            uVal[BCS_BACKGROUND] := Brush{ Color{ aBGFormula[1], 
aBGFormula[2], aBGFormula[3] } }
            uVal[BCS_FOREGROUND] := Color{ aFGFormula[1], aFGFormula[2], 
aFGFormula[3] }
    endif
RETURN uVal

Again, I'm using it for row colorconditions but it should be able to be 
adapted for column colorconditions.

HTH

Glen Townsley

wrote in message 
news:781533f1-4af6-4b80-b38c-6e98fa1a30d8@googlegroups.com...

Hi everyone, there is a simple way to paint a cell indicating row (or recno) 
and column?
Today, if i want to paint a cell i use color conditions on columns and puts 
as condition something like:
Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so 
on...

but i think tha must be a better solution.
Regards.

Sebastián 

[toc] | [prev] | [next] | [standalone]


#11102

Fromccyasa.sbassano@gmail.com
Date2017-10-28 05:38 -0700
Message-ID<881abf8f-b0c4-420e-9344-2bddc35ba830@googlegroups.com>
In reply to#11100
El viernes, 27 de octubre de 2017, 16:55:22 (UTC-3), Glen Townsley escribió:
> Sebastian,
> 
> There are 2 ways I have approached this.
> 
> 1. I create a protected variable of the server called aHiLite and fill it 
> with the the record numbers of the records I want to highlight. The the 
> colorcondition becomes something like
> 
> oColorCondition := bColorCondition{    { |oS| oS:IsHiLite() }, ;
>                                                                 oItemArrServer, 
> ;
>                                                                 color{ 
> SELF:Owner:nHiLiteR, SELF:Owner:nHiLiteG, SELF:Owner:nHiLiteB }, ;
>                                                                    }
> I am using a foreground highlight, but you could easily use it for 
> background highlights.
> 
> 2. There is a little known feature of bBrowser that I have just started to 
> use in the last month or so. The colorcondition's second parameter need not 
> be a server object. So you can use
> 
> oColorCondition := bColorCondition{    { |oWindow| 
> oWindow:ColourConditions() }, ;
>                                                                     SELF, ;
>                                                                     , ;
>                                                                      }
> oB:ColorCondition:Add( oColorCondition )
> 
> and call a method of the window. This method can return true/false but it 
> can also return an array. The method might look like
> 
> METHOD ColourConditions() CLASS QtyAtCompMgtWin
>     LOCAL uVal                                AS USUAL                    // 
> can be array or false
>     LOCAL oS                                AS bArrayServer
>     LOCAL oB                                AS scbBrowser
>     LOCAL aBGFormula                        AS ARRAY
>     LOCAL aFGFormula                        AS ARRAY
>     LOCAL oIni                                AS scFabRegistry
> 
>     uVal := FALSE
> 
>     oB := SELF:oDCbBrowseItems
>     oS := oB:Server
> 
>     IF PCE_IsFormula( cDesc ) != #NOFORMULA 
> // formula
>             aBGFormula := { oIni:GetIniString( 'FORMULA', 'MAKE_BG_RED', 
> 251 ), ;
>                                         oIni:GetIniString( 'FORMULA', 
> 'MAKE_BG_GREEN', 245 ), ;
>                                         oIni:GetIniString( 'FORMULA', 
> 'MAKE_BG_BLUE', 181 ) }
>             aFGFormula := { oIni:GetIniString( 'FORMULA', 'MAKE_FG_RED', 
> 0 ), ;
>                                         oIni:GetIniString( 'FORMULA', 
> 'MAKE_FG_GREEN', 0 ), ;
>                                         oIni:GetIniString( 'FORMULA', 
> 'MAKE_FG_BLUE', 0 ) }
>             uVal := ArrayNew( BCS_ITEMS )
>             uVal[BCS_BACKGROUND] := Brush{ Color{ aBGFormula[1], 
> aBGFormula[2], aBGFormula[3] } }
>             uVal[BCS_FOREGROUND] := Color{ aFGFormula[1], aFGFormula[2], 
> aFGFormula[3] }
>     endif
> RETURN uVal
> 
> Again, I'm using it for row colorconditions but it should be able to be 
> adapted for column colorconditions.
> 
> HTH
> 
> Glen Townsley
> 
> wrote in message 
> news:...
> 
> Hi everyone, there is a simple way to paint a cell indicating row (or recno) 
> and column?
> Today, if i want to paint a cell i use color conditions on columns and puts 
> as condition something like:
> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so 
> on...
> 
> but i think tha must be a better solution.
> Regards.
> 
> Sebastián

Hi Glen, i use a similar approach and works fine, my post was thinking that may be exist a more direct way to do.
Regards.

[toc] | [prev] | [next] | [standalone]


#11107

FromMartin <Martin@spam.spam>
Date2017-10-31 12:08 +0000
Message-ID<ot9p3r$orr$1@dont-email.me>
In reply to#11097
What do you want to actually achieve?

I have done some interesting things with this.

On 27/10/2017 00:31, ccyasa.sbassano@gmail.com wrote:
> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
> 
> but i think tha must be a better solution.
> Regards.
> 
> Sebastián
> 

[toc] | [prev] | [next] | [standalone]


#11108

From"Urs Eggmann" <Urs.Eggmann@shinternet.ch>
Date2017-10-31 13:12 +0100
Message-ID<f5r7q1Fna9vU1@mid.individual.net>
In reply to#11107
and why don't you share it with us ?

Urs


"Martin" <Martin@spam.spam> schrieb im Newsbeitrag 
news:ot9p3r$orr$1@dont-email.me...
> What do you want to actually achieve?
>
> I have done some interesting things with this.
>
> On 27/10/2017 00:31, ccyasa.sbassano@gmail.com wrote:
>> Hi everyone, there is a simple way to paint a cell indicating row (or 
>> recno) and column?
>> Today, if i want to paint a cell i use color conditions on columns and 
>> puts as condition something like:
>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so 
>> on...
>>
>> but i think tha must be a better solution.
>> Regards.
>>
>> Sebastián
>>
> 

[toc] | [prev] | [next] | [standalone]


#11113

FromMartin <Martin@spam.spam>
Date2017-10-31 15:06 +0000
Message-ID<ota3i2$bkr$1@dont-email.me>
In reply to#11108
Because different people have differnt ideas and some people may think 
my contribution is poor or not worth looking at, but this chap may want 
to do something similar to what I have done.

On 31/10/2017 12:12, Urs Eggmann wrote:
> and why don't you share it with us ?
> 
> Urs
> 
> 
> "Martin" <Martin@spam.spam> schrieb im Newsbeitrag 
> news:ot9p3r$orr$1@dont-email.me...
>> What do you want to actually achieve?
>>
>> I have done some interesting things with this.
>>
>> On 27/10/2017 00:31, ccyasa.sbassano@gmail.com wrote:
>>> Hi everyone, there is a simple way to paint a cell indicating row (or 
>>> recno) and column?
>>> Today, if i want to paint a cell i use color conditions on columns 
>>> and puts as condition something like:
>>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. 
>>> and so on...
>>>
>>> but i think tha must be a better solution.
>>> Regards.
>>>
>>> Sebastián
>>>
>>
> 

[toc] | [prev] | [next] | [standalone]


#11109

Fromccyasa.sbassano@gmail.com
Date2017-10-31 06:32 -0700
Message-ID<a204c48a-ab3e-4c0d-bba6-2289937e5976@googlegroups.com>
In reply to#11107
El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
> What do you want to actually achieve?
> 
> I have done some interesting things with this.
> 
> On 27/10/2017 00:31, ... wrote:
> > Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
> > Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
> > Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
> > 
> > but i think tha must be a better solution.
> > Regards.
> > 
> > Sebastián
> >

Hi, the code that i use is similar to this one:

PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog

	LOCAL aRecord:= {} AS ARRAY
	LOCAL aColorCondition:= {} AS ARRAY
	LOCAL cColorCondition:= NULL_STRING AS STRING
	LOCAL dwColumn:= 1 AS DWORD
	LOCAL oColumn AS bDataColumn

	//	The table has more than one record and the comparable coluns are configured
	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
		SELF:oDCBBTable:SuspendNotification()
		SELF:oDCBBTable:Server:GoTop()

		//	Initialize the color conditions array
		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
		AEvalA(aColorCondition, {|aElement| aElement:= {}})

		// Copy the current record to an array
		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)

		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
		SELF:oDCBBTable:Server:Skip()
		DO WHILE !SELF:oDCBBTable:Server:EoF
			//	Collect the records with differences in the comparable columns
			FOR dwColumn:= 1 UPTO ALen(aRecord)
				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo)) 
					ENDIF
				ENDIF
			NEXT 

			//	Copy the current record to the array
			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)

			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
			SELF:oDCBBTable:Server:Skip()
		ENDDO 

		//	Add all the color conditions
		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
			IF !Empty(aColorCondition[dwColumn])
				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn]) 
				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
				oColumn:ColorCondition:Clear()
				oColumn:ColorCondition:Add(;
					bColorCondition{;
						cColorCondition,;
						SELF:oDCBBTable:Server,;
						NIL,;
						Brush{Color{COLORRED}};
					};
				)
			ENDIF
		NEXT

		//	Refresh the bBrowser
		SELF:oDCBBTable:Refresh()
		SELF:oDCBBTable:ResetNotification()
		SELF:oDCBBTable:Server:GoTop()
	ENDIF

	RETURN NIL

The result is like that the one showed in the link:
http://es.tinypic.com/view.php?pic=30b1suf&s=9

[toc] | [prev] | [next] | [standalone]


#11110

FromJames Martin <james@northwoodlumber.com>
Date2017-10-31 10:33 -0400
Message-ID<ota1k9$su6$1@dont-email.me>
In reply to#11109
DataServerHelper{}:RecordAsArray(). Is this a class you wrote?

James

On 2017-10-31 09:32 AM, ccyasa.sbassano@gmail.com wrote:
> El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
>> What do you want to actually achieve?
>>
>> I have done some interesting things with this.
>>
>> On 27/10/2017 00:31, ... wrote:
>>> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
>>> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
>>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
>>>
>>> but i think tha must be a better solution.
>>> Regards.
>>>
>>> Sebastián
>>>
> 
> Hi, the code that i use is similar to this one:
> 
> PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog
> 
> 	LOCAL aRecord:= {} AS ARRAY
> 	LOCAL aColorCondition:= {} AS ARRAY
> 	LOCAL cColorCondition:= NULL_STRING AS STRING
> 	LOCAL dwColumn:= 1 AS DWORD
> 	LOCAL oColumn AS bDataColumn
> 
> 	//	The table has more than one record and the comparable coluns are configured
> 	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
> 		SELF:oDCBBTable:SuspendNotification()
> 		SELF:oDCBBTable:Server:GoTop()
> 
> 		//	Initialize the color conditions array
> 		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
> 		AEvalA(aColorCondition, {|aElement| aElement:= {}})
> 
> 		// Copy the current record to an array
> 		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> 
> 		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
> 		SELF:oDCBBTable:Server:Skip()
> 		DO WHILE !SELF:oDCBBTable:Server:EoF
> 			//	Collect the records with differences in the comparable columns
> 			FOR dwColumn:= 1 UPTO ALen(aRecord)
> 				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
> 					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
> 						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo))
> 					ENDIF
> 				ENDIF
> 			NEXT
> 
> 			//	Copy the current record to the array
> 			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> 
> 			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
> 			SELF:oDCBBTable:Server:Skip()
> 		ENDDO
> 
> 		//	Add all the color conditions
> 		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
> 			IF !Empty(aColorCondition[dwColumn])
> 				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn])
> 				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
> 				oColumn:ColorCondition:Clear()
> 				oColumn:ColorCondition:Add(;
> 					bColorCondition{;
> 						cColorCondition,;
> 						SELF:oDCBBTable:Server,;
> 						NIL,;
> 						Brush{Color{COLORRED}};
> 					};
> 				)
> 			ENDIF
> 		NEXT
> 
> 		//	Refresh the bBrowser
> 		SELF:oDCBBTable:Refresh()
> 		SELF:oDCBBTable:ResetNotification()
> 		SELF:oDCBBTable:Server:GoTop()
> 	ENDIF
> 
> 	RETURN NIL
> 
> The result is like that the one showed in the link:
> http://es.tinypic.com/view.php?pic=30b1suf&s=9
> 

[toc] | [prev] | [next] | [standalone]


#11111

Fromccyasa.sbassano@gmail.com
Date2017-10-31 07:58 -0700
Message-ID<23d56fae-f500-4869-9020-0eb45c05ebbf@googlegroups.com>
In reply to#11110
El martes, 31 de octubre de 2017, 11:33:46 (UTC-3), James Martin escribió:
> DataServerHelper{}:RecordAsArray(). Is this a class you wrote?
> 
> James
> 
> On 2017-10-31 09:32 AM, ... wrote:
> > El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
> >> What do you want to actually achieve?
> >>
> >> I have done some interesting things with this.
> >>
> >> On 27/10/2017 00:31, ... wrote:
> >>> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
> >>> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
> >>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
> >>>
> >>> but i think tha must be a better solution.
> >>> Regards.
> >>>
> >>> Sebastián
> >>>
> > 
> > Hi, the code that i use is similar to this one:
> > 
> > PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog
> > 
> > 	LOCAL aRecord:= {} AS ARRAY
> > 	LOCAL aColorCondition:= {} AS ARRAY
> > 	LOCAL cColorCondition:= NULL_STRING AS STRING
> > 	LOCAL dwColumn:= 1 AS DWORD
> > 	LOCAL oColumn AS bDataColumn
> > 
> > 	//	The table has more than one record and the comparable coluns are configured
> > 	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
> > 		SELF:oDCBBTable:SuspendNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 
> > 		//	Initialize the color conditions array
> > 		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
> > 		AEvalA(aColorCondition, {|aElement| aElement:= {}})
> > 
> > 		// Copy the current record to an array
> > 		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
> > 		SELF:oDCBBTable:Server:Skip()
> > 		DO WHILE !SELF:oDCBBTable:Server:EoF
> > 			//	Collect the records with differences in the comparable columns
> > 			FOR dwColumn:= 1 UPTO ALen(aRecord)
> > 				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
> > 					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
> > 						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo))
> > 					ENDIF
> > 				ENDIF
> > 			NEXT
> > 
> > 			//	Copy the current record to the array
> > 			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
> > 			SELF:oDCBBTable:Server:Skip()
> > 		ENDDO
> > 
> > 		//	Add all the color conditions
> > 		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
> > 			IF !Empty(aColorCondition[dwColumn])
> > 				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn])
> > 				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
> > 				oColumn:ColorCondition:Clear()
> > 				oColumn:ColorCondition:Add(;
> > 					bColorCondition{;
> > 						cColorCondition,;
> > 						SELF:oDCBBTable:Server,;
> > 						NIL,;
> > 						Brush{Color{COLORRED}};
> > 					};
> > 				)
> > 			ENDIF
> > 		NEXT
> > 
> > 		//	Refresh the bBrowser
> > 		SELF:oDCBBTable:Refresh()
> > 		SELF:oDCBBTable:ResetNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 	ENDIF
> > 
> > 	RETURN NIL
> > 
> > The result is like that the one showed in the link:
> > http://es.tinypic.com/view.php?pic=30b1suf&s=9
> >

Yes, same as ArrayHelper.
RecordAsArray(oDataServer) return an array with the data of the record, the code is like this:

METHOD RegistroComoArreglo(oTabla AS DataServer) AS ARRAY PASCAL CLASS ServidorDeDatosAyudante

LOCAL aRecord AS ARRAY
LOCAL dwColumn AS DWORD

aRecord:= ArrayNew(oDataServer:FCount)
FOR dwColumn:= 1 UPTO ALen(aRecord)
	aRecord[dwColumn]:= oDataServer:FieldGet(dwColumn) 
NEXT

RETURN aRecord,

ArrayHelper{}:Join(cGlue AS STRING, aPiece AS ARRAY) joins the elements of aPiece. In my code joins the color conditions with .OR.

[toc] | [prev] | [next] | [standalone]


#11112

Fromccyasa.sbassano@gmail.com
Date2017-10-31 08:00 -0700
Message-ID<29a4170a-9248-434b-90d3-eb82bf97050e@googlegroups.com>
In reply to#11110
El martes, 31 de octubre de 2017, 11:33:46 (UTC-3), James Martin escribió:
> DataServerHelper{}:RecordAsArray(). Is this a class you wrote?
> 
> James
> 
> On 2017-10-31 09:32 AM, ... wrote:
> > El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
> >> What do you want to actually achieve?
> >>
> >> I have done some interesting things with this.
> >>
> >> On 27/10/2017 00:31, ... wrote:
> >>> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
> >>> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
> >>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
> >>>
> >>> but i think tha must be a better solution.
> >>> Regards.
> >>>
> >>> Sebastián
> >>>
> > 
> > Hi, the code that i use is similar to this one:
> > 
> > PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog
> > 
> > 	LOCAL aRecord:= {} AS ARRAY
> > 	LOCAL aColorCondition:= {} AS ARRAY
> > 	LOCAL cColorCondition:= NULL_STRING AS STRING
> > 	LOCAL dwColumn:= 1 AS DWORD
> > 	LOCAL oColumn AS bDataColumn
> > 
> > 	//	The table has more than one record and the comparable coluns are configured
> > 	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
> > 		SELF:oDCBBTable:SuspendNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 
> > 		//	Initialize the color conditions array
> > 		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
> > 		AEvalA(aColorCondition, {|aElement| aElement:= {}})
> > 
> > 		// Copy the current record to an array
> > 		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
> > 		SELF:oDCBBTable:Server:Skip()
> > 		DO WHILE !SELF:oDCBBTable:Server:EoF
> > 			//	Collect the records with differences in the comparable columns
> > 			FOR dwColumn:= 1 UPTO ALen(aRecord)
> > 				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
> > 					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
> > 						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo))
> > 					ENDIF
> > 				ENDIF
> > 			NEXT
> > 
> > 			//	Copy the current record to the array
> > 			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
> > 			SELF:oDCBBTable:Server:Skip()
> > 		ENDDO
> > 
> > 		//	Add all the color conditions
> > 		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
> > 			IF !Empty(aColorCondition[dwColumn])
> > 				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn])
> > 				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
> > 				oColumn:ColorCondition:Clear()
> > 				oColumn:ColorCondition:Add(;
> > 					bColorCondition{;
> > 						cColorCondition,;
> > 						SELF:oDCBBTable:Server,;
> > 						NIL,;
> > 						Brush{Color{COLORRED}};
> > 					};
> > 				)
> > 			ENDIF
> > 		NEXT
> > 
> > 		//	Refresh the bBrowser
> > 		SELF:oDCBBTable:Refresh()
> > 		SELF:oDCBBTable:ResetNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 	ENDIF
> > 
> > 	RETURN NIL
> > 
> > The result is like that the one showed in the link:
> > http://es.tinypic.com/view.php?pic=30b1suf&s=9
> >

Yes, same as ArrayHelper.
RecordAsArray(oDataServer) return an array with the data of the record, the code is like this:

METHOD RecordAsArray(oDataServer AS DataServer) AS ARRAY PASCAL CLASS DataServerHelper

LOCAL aRecord AS ARRAY
LOCAL dwColumn AS DWORD

aRecord:= ArrayNew(oDataServer:FCount)
FOR dwColumn:= 1 UPTO ALen(aRecord)
        aRecord[dwColumn]:= oDataServer:FieldGet(dwColumn)
NEXT

RETURN aRecord

ArrayHelper{}:Join(cGlue AS STRING, aPiece AS ARRAY) joins the elements of aPiece. In my code joins the color conditions with .OR.

[toc] | [prev] | [next] | [standalone]


#11114

FromMartin <Martin@spam.spam>
Date2017-10-31 15:12 +0000
Message-ID<ota3s8$f5l$1@dont-email.me>
In reply to#11109
In this case I would put the colour flag back into the base server and 
run a simple condition which sets the colour rather than build condition 
on the fly.

I have often added an array server to a data server to create a special 
data server with everything merged in.

On 31/10/2017 13:32, ccyasa.sbassano@gmail.com wrote:
> El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
>> What do you want to actually achieve?
>>
>> I have done some interesting things with this.
>>
>> On 27/10/2017 00:31, ... wrote:
>>> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
>>> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
>>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
>>>
>>> but i think tha must be a better solution.
>>> Regards.
>>>
>>> Sebastián
>>>
> 
> Hi, the code that i use is similar to this one:
> 
> PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog
> 
> 	LOCAL aRecord:= {} AS ARRAY
> 	LOCAL aColorCondition:= {} AS ARRAY
> 	LOCAL cColorCondition:= NULL_STRING AS STRING
> 	LOCAL dwColumn:= 1 AS DWORD
> 	LOCAL oColumn AS bDataColumn
> 
> 	//	The table has more than one record and the comparable coluns are configured
> 	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
> 		SELF:oDCBBTable:SuspendNotification()
> 		SELF:oDCBBTable:Server:GoTop()
> 
> 		//	Initialize the color conditions array
> 		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
> 		AEvalA(aColorCondition, {|aElement| aElement:= {}})
> 
> 		// Copy the current record to an array
> 		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> 
> 		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
> 		SELF:oDCBBTable:Server:Skip()
> 		DO WHILE !SELF:oDCBBTable:Server:EoF
> 			//	Collect the records with differences in the comparable columns
> 			FOR dwColumn:= 1 UPTO ALen(aRecord)
> 				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
> 					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
> 						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo))
> 					ENDIF
> 				ENDIF
> 			NEXT
> 
> 			//	Copy the current record to the array
> 			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> 
> 			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
> 			SELF:oDCBBTable:Server:Skip()
> 		ENDDO
> 
> 		//	Add all the color conditions
> 		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
> 			IF !Empty(aColorCondition[dwColumn])
> 				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn])
> 				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
> 				oColumn:ColorCondition:Clear()
> 				oColumn:ColorCondition:Add(;
> 					bColorCondition{;
> 						cColorCondition,;
> 						SELF:oDCBBTable:Server,;
> 						NIL,;
> 						Brush{Color{COLORRED}};
> 					};
> 				)
> 			ENDIF
> 		NEXT
> 
> 		//	Refresh the bBrowser
> 		SELF:oDCBBTable:Refresh()
> 		SELF:oDCBBTable:ResetNotification()
> 		SELF:oDCBBTable:Server:GoTop()
> 	ENDIF
> 
> 	RETURN NIL
> 
> The result is like that the one showed in the link:
> http://es.tinypic.com/view.php?pic=30b1suf&s=9
> 

[toc] | [prev] | [next] | [standalone]


#11115

Fromccyasa.sbassano@gmail.com
Date2017-10-31 09:07 -0700
Message-ID<32c86fd0-596c-41ca-babe-a81a232d1933@googlegroups.com>
In reply to#11114
El martes, 31 de octubre de 2017, 12:12:09 (UTC-3), Martin escribió:
> In this case I would put the colour flag back into the base server and 
> run a simple condition which sets the colour rather than build condition 
> on the fly.
> 
> I have often added an array server to a data server to create a special 
> data server with everything merged in.
> 
> On 31/10/2017 13:32, ... wrote:
> > El martes, 31 de octubre de 2017, 9:08:28 (UTC-3), Martin escribió:
> >> What do you want to actually achieve?
> >>
> >> I have done some interesting things with this.
> >>
> >> On 27/10/2017 00:31, ... wrote:
> >>> Hi everyone, there is a simple way to paint a cell indicating row (or recno) and column?
> >>> Today, if i want to paint a cell i use color conditions on columns and puts as condition something like:
> >>> Server:Recno = 1 .OR. Server:Recno = 7 .OR. Server:Recno = 23 .OR. and so on...
> >>>
> >>> but i think tha must be a better solution.
> >>> Regards.
> >>>
> >>> Sebastián
> >>>
> > 
> > Hi, the code that i use is similar to this one:
> > 
> > PROTECT METHOD _HighlightDifferencesBetweenAdjacentRecords() CLASS MyDialog
> > 
> > 	LOCAL aRecord:= {} AS ARRAY
> > 	LOCAL aColorCondition:= {} AS ARRAY
> > 	LOCAL cColorCondition:= NULL_STRING AS STRING
> > 	LOCAL dwColumn:= 1 AS DWORD
> > 	LOCAL oColumn AS bDataColumn
> > 
> > 	//	The table has more than one record and the comparable coluns are configured
> > 	IF (SELF:oDCBBTable:Server:RecCount > 1) .AND. !Empty(SELF:aComparableColumns)
> > 		SELF:oDCBBTable:SuspendNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 
> > 		//	Initialize the color conditions array
> > 		aColorCondition:= ArrayNew(SELF:oDCBBTable:Server:FCount)
> > 		AEvalA(aColorCondition, {|aElement| aElement:= {}})
> > 
> > 		// Copy the current record to an array
> > 		aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 		//	Move to second record, at this momente we have the first record in the array and the second record pointed by the table cursor.
> > 		SELF:oDCBBTable:Server:Skip()
> > 		DO WHILE !SELF:oDCBBTable:Server:EoF
> > 			//	Collect the records with differences in the comparable columns
> > 			FOR dwColumn:= 1 UPTO ALen(aRecord)
> > 				IF (AScanExact(SELF:aComparableColumns, SELF:oDCBBTable:Server:FieldSym(dwColumn)) > 0)
> > 					IF !(aRecord[dwColumn] == SELF:oDCBBTable:Server:FieldGet(dwColumn))
> > 						AAdd(aColorCondition[dwColumn], "Server:RecNo = " + NTrim(SELF:oDCBBTable:Server:RecNo))
> > 					ENDIF
> > 				ENDIF
> > 			NEXT
> > 
> > 			//	Copy the current record to the array
> > 			aRecord:= DataServerHelper{}:RecordAsArray(SELF:oDCBBTable:Server)
> > 
> > 			//	Move to next record, the previous record is in the array and the cureent one is pointed by tehe table cursor
> > 			SELF:oDCBBTable:Server:Skip()
> > 		ENDDO
> > 
> > 		//	Add all the color conditions
> > 		FOR dwColumn:= 1 UPTO ALen(aColorCondition)
> > 			IF !Empty(aColorCondition[dwColumn])
> > 				cColorCondition:= ArrayHelper{}:Join(" .OR. ", aColorCondition[dwColumn])
> > 				oColumn:= SELF:oDCBBTable:GetOpenColumn(SELF:oDCBBTable:Server:FieldName(dwColumn))
> > 				oColumn:ColorCondition:Clear()
> > 				oColumn:ColorCondition:Add(;
> > 					bColorCondition{;
> > 						cColorCondition,;
> > 						SELF:oDCBBTable:Server,;
> > 						NIL,;
> > 						Brush{Color{COLORRED}};
> > 					};
> > 				)
> > 			ENDIF
> > 		NEXT
> > 
> > 		//	Refresh the bBrowser
> > 		SELF:oDCBBTable:Refresh()
> > 		SELF:oDCBBTable:ResetNotification()
> > 		SELF:oDCBBTable:Server:GoTop()
> > 	ENDIF
> > 
> > 	RETURN NIL
> > 
> > The result is like that the one showed in the link:
> > http://es.tinypic.com/view.php?pic=30b1suf&s=9
> >

I don't understand the "put the colour flag back into the base server". In my case de server change, also the columns, the dialog is a generic one to show the history of all tables of my system.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web