Alaska Software Inc. - How to change background color of the current row in XbpBrowse()
Username: Password:
AuthorTopic: How to change background color of the current row in XbpBrowse()
Jacob JohnHow to change background color of the current row in XbpBrowse()
on Thu, 16 Nov 2017 16:30:48 +0530
Hi,

We have a XbpBrowse object display records from a temporary table. It
is an attendance marking system. The browse has following columns
Employee code, Emp. Name,1,2,3,..........29,30,31

Problem is, when the user marks attendance for a day, for example 29th
column, he is confusing whether he is marking attendance of 5th or 6th
employee. So he wants the current row (for which employee's attendance
is marking now) to highlitened. 

We can achieve this by setting the Cursor mode XPPBW_CURSOR_ROW. But
the problem is we can select a cell with mouse click. But can not
enable the cell with keyboard (Enter Key). Is there any solution for
that ?

How can i set the background color of the current row in the browser
by keeping the Cursor Mode as XPPBRW_CURSOR_COLUMN ?

Thanks in Advance

Regards

Kiron
Jim LeeRe: How to change background color of the current row in XbpBrowse()
on Thu, 16 Nov 2017 18:12:04 +0100
to mark a Row you can add a "extra" Columne as 1st where you set a 
"Checkmark" e.g Checkbox()
(Re: How to put a CheckBox in a xbpbrowser., 20. Dezember 2002, 
archived.generic)

there is no XPPBRW_CURSOR_COLUMN !
you can use o:cursorMode : XBPBRW_CURSOR_ROW or XBPBRW_CURSOR_CELL

color can be use by o:Colorblock and set oBrowse:Usevisualstyle := .F.
Jacob JohnRe: How to change background color of the current row in XbpBrowse()
on Sat, 18 Nov 2017 17:02:05 +0530
Hi,

There is no checkbox or any other marking in the browser. System
should automatically identify the current row and change the color
uing :colorblock. Is there any way to do that ?

Yes. Its XBPBRW_CURSOR_CELL 


Regards
Kiron

On Thu, 16 Nov 2017 18:12:04 +0100, Jim Lee wrote:

>to mark a Row you can add a "extra" Columne as 1st where you set a 
>"Checkmark" e.g Checkbox()
>(Re: How to put a CheckBox in a xbpbrowser., 20. Dezember 2002, 
>archived.generic)
>
>there is no XPPBRW_CURSOR_COLUMN !
>you can use o:cursorMode : XBPBRW_CURSOR_ROW or XBPBRW_CURSOR_CELL
>
>color can be use by o:Colorblock and set oBrowse:Usevisualstyle := .F.
>
Jim LeeRe: How to change background color of the current row in XbpBrowse()
on Sun, 19 Nov 2017 01:16:23 +0100
hi,

> There is no checkbox or any other marking in the browser. System
> should automatically identify the current row and change the color
> uing :colorblock. Is there any way to do that ?

but you need "something" to identify which row is marked or not

{|xValue| IIf( Deleted() ,;
              {GRA_CLR_WHITE, GRA_CLR_RED} ,;
              {GRA_CLR_BLACK, GRA_CLR_WHITE ) }
Jacob JohnRe: How to change background color of the current row in XbpBrowse()
on Mon, 20 Nov 2017 16:36:03 +0530
On Sun, 19 Nov 2017 01:16:23 +0100, Jim Lee wrote:

>hi,
>
>> There is no checkbox or any other marking in the browser. System
>> should automatically identify the current row and change the color
>> uing :colorblock. Is there any way to do that ?
>
>but you need "something" to identify which row is marked or not
Exactly. How can check the current row ?

>
>{|xValue| IIf( Deleted() ,;
>              {GRA_CLR_WHITE, GRA_CLR_RED} ,;
>              {GRA_CLR_BLACK, GRA_CLR_WHITE ) }
>
>
Jacob JohnRe: How to change background color of the current row in XbpBrowse()
on Mon, 20 Nov 2017 17:45:32 +0530
I tried following

oBrowse:itemMarked:={|| nCurRow:=oBrowse:rowPos}
oBrowse:getColumn(1):ColorBlock:={||Iif(nCurRow==oBrowse:rowPos,{GRA_CLR_RED,Nil},{GRA_CLR_BLACK,Nil})

But not working

Kiron


On Mon, 20 Nov 2017 16:36:03 +0530, Jacob John wrote:

>On Sun, 19 Nov 2017 01:16:23 +0100, Jim Lee wrote:
>
>>hi,
>>
>>> There is no checkbox or any other marking in the browser. System
>>> should automatically identify the current row and change the color
>>> uing :colorblock. Is there any way to do that ?
>>
>>but you need "something" to identify which row is marked or not
>Exactly. How can check the current row ?
>
>>
>>{|xValue| IIf( Deleted() ,;
>>              {GRA_CLR_WHITE, GRA_CLR_RED} ,;
>>              {GRA_CLR_BLACK, GRA_CLR_WHITE ) }
>>
>>
Jim LeeRe: How to change background color of the current row in XbpBrowse()
on Mon, 20 Nov 2017 19:32:18 +0100
> I tried following
>
> oBrowse:itemMarked:={|| nCurRow:=oBrowse:rowPos}
> oBrowse:getColumn(1):ColorBlock:={||Iif(nCurRow==oBrowse:rowPos,{GRA_CLR_RED,Nil},{GRA_CLR_BLACK,Nil})

o:Colorblock is under "Configuration" so you need it before o:Create() / 
o:addColumn()

XbpBrowse() does not have "multi select" ... you must add a "extra" Column 
for "Marker" (Type "L" )
if you navigate in XbpBrowse() "every active" Record() -> o:itemmark

---

if using Manifest File you MUST set

   oBrowse:useVisualStyle := .F.

to show o:Colorblock
James LoughnerRe: How to change background color of the current row in XbpBrowse()
on Tue, 21 Nov 2017 13:29:12 -0500
Lock the first column or two to show what row. I assume that these 
indicate the row value


On 11/20/2017 01:32 PM, Jim Lee wrote:
>> I tried following
>>
>> oBrowse:itemMarked:={|| nCurRow:=oBrowse:rowPos}
>> oBrowse:getColumn(1):ColorBlock:={||Iif(nCurRow==oBrowse:rowPos,{GRA_CLR_RED,Nil},{GRA_CLR_BLACK,Nil})
> 
> o:Colorblock is under "Configuration" so you need it before o:Create() /
> o:addColumn()
> 
> XbpBrowse() does not have "multi select" ... you must add a "extra" Column
> for "Marker" (Type "L" )
> if you navigate in XbpBrowse() "every active" Record() -> o:itemmark
> 
> ---
> 
> if using Manifest File you MUST set
> 
>     oBrowse:useVisualStyle := .F.
> 
> to show o:Colorblock
> 
> 
>
Jacob JohnRe: How to change background color of the current row in XbpBrowse() - Attendance.png (0/1)
on Wed, 22 Nov 2017 11:49:58 +0530
Hi,

Please refer attaed screenshot. Actually current cursor position is at
29th column and at 5th row. It is littile bit difficult when doing the
continous data entry.

So if we can change the color of current row user can easily identify
the employee.

Regards
Kiron

On Tue, 21 Nov 2017 13:29:12 -0500, James Loughner wrote:

>Lock the first column or two to show what row. I assume that these 
>indicate the row value
>
>
>On 11/20/2017 01:32 PM, Jim Lee wrote:
>>> I tried following
>>>
>>> oBrowse:itemMarked:={|| nCurRow:=oBrowse:rowPos}
>>> oBrowse:getColumn(1):ColorBlock:={||Iif(nCurRow==oBrowse:rowPos,{GRA_CLR_RED,Nil},{GRA_CLR_BLACK,Nil})
>> 
>> o:Colorblock is under "Configuration" so you need it before o:Create() /
>> o:addColumn()
>> 
>> XbpBrowse() does not have "multi select" ... you must add a "extra" Column
>> for "Marker" (Type "L" )
>> if you navigate in XbpBrowse() "every active" Record() -> o:itemmark
>> 
>> ---
>> 
>> if using Manifest File you MUST set
>> 
>>     oBrowse:useVisualStyle := .F.
>> 
>> to show o:Colorblock
>> 
>> 
>>
Jacob JohnRe: How to change background color of the current row in XbpBrowse() - Attendance.png (1/1)
on Wed, 22 Nov 2017 11:49:59 +0530
Jonathan LeemingRe: How to change background color of the current row in XbpBrowse() - Attendance.png (1/1)
on Thu, 23 Nov 2017 11:03:48 -0700
Hi,

I have been playing around with your issue and may have a solution... 
although convoluted... it seems to work.

I first created 2 local variables in the function where the browse is 
created...

LOCAL lStable := .F., nRecNo := 0

I then assigned a colorblock to the first column with Engage being the 
file I am browsing...

oBrowse:getColumn(1):ColorBlock := {||IF(lStable .AND. Engage->(RECNO()) 
== nRecNo,{tdWHI,tdBLK},{tdBLK,tdWHI})}

oBrowse:StableBlock := {||IF(.NOT. lStable,(lStable := 
.T.,nRecNo:=Engage->(RecNo()),oBrowse:RefreshAll(),oBrowse:ForceStable()),NIL),lStable 
:= .F.}

As I said... it's convoluted but appears to work.

Of course, if there was an iVar or method that would return the data 
file record number that the browse will be settling on once it is stable 
then it would be a much simpler process.

Then again, it would not surprose me if someone else proposes a solution 
that show how foolish mine is

Regards... Jonathan


On 11/21/2017 11:19 PM, Jacob John wrote: