Page 1 of 1

XBROWSE ARRAY go to some ROW

PostPosted: Sat Jun 21, 2014 1:25 am
by avista
Hi

I have array xbrowse
I have seen methods GoTop(), GoBottom(), GoUp() ...
BUT how to go directly to some row ... example row 1536
something like SelectRow( n )
(have i missed some method ?)

Best regards,

Re: XBROWSE ARRAY go to some ROW

PostPosted: Sat Jun 21, 2014 1:54 am
by nageswaragunupudi
For array browse only
Code: Select all  Expand view
oBrw:nArrayAt := 1536
oBrw:Refresh()


We better use a more generic approach, which works for any datasource (dbf/ado/array,etc)

For datasources other than arrays, visual serial number depends on the sort order. eg OrdKeyNo() or its equivalent. On the other hand each row has a record id eg. RecNo() or equivalent.

To go to a particular visual serial no: (I suggest using this in your case of array browse)
Code: Select all  Expand view
oBrw:KeyNo := 1536
oBrw:Refresh()


To go to a particular record id ( like RecNo() of a dbf )
Code: Select all  Expand view
oBrw:BookMark := 1536
oBrw:Refresh()

Re: XBROWSE ARRAY go to some ROW

PostPosted: Sat Jun 21, 2014 6:39 am
by cnavarro
Mr Rao
It could include one xbrowse Method goRec( nRec ) to do this?

Re: XBROWSE ARRAY go to some ROW

PostPosted: Mon Jun 23, 2014 6:57 am
by avista
Thanks Rao,

BTW i agree with cnavarro, it can be included like a Method in xBrowse

Best regards,

Re: XBROWSE ARRAY go to some ROW

PostPosted: Mon Jun 23, 2014 1:04 pm
by byte-one
A question in this context: I go to a line as above described, then i will select it in the same way as i click on the mouse on this row.

Re: XBROWSE ARRAY go to some ROW

PostPosted: Mon Jun 23, 2014 2:28 pm
by nageswaragunupudi
byte-one wrote:A question in this context: I go to a line as above described, then i will select it in the same way as i click on the mouse on this row.

The new row will be the selected row.

Re: XBROWSE ARRAY go to some ROW

PostPosted: Tue Jun 24, 2014 11:48 am
by byte-one
Mr. Rao, yes it is now the selected row, but the colors from ::bClrRowFocus are not shown !? Only when i click in the row this color is in use. I will display the selected row in ::bClrRowFocus-colors without using the mouse.
A second question: When i use this selected row i will automatically go to the first editable col and activate it. Which way i shold go?
Many thanks!

Re: XBROWSE ARRAY go to some ROW

PostPosted: Tue Jun 24, 2014 9:14 pm
by nageswaragunupudi
Mr. Rao, yes it is now the selected row, but the colors from ::bClrRowFocus are not shown !? Only when i click in the row this color is in use. I will display the selected row in ::bClrRowFocus-colors without using the mouse.

When you use oBrw:bClrRowFocus, you need to set oBrw:nMarqueeStyle to one of the MARQSTYLE_HIGHLROW* constants. In your case, I presume you might have set it to MARQSTYLE_HIGHLROWMS. This style puts the browse in multiselect mode. If in multiselect mode, we need to add oBrw:Select(1) also before oBrw:Refresh().
Code: Select all  Expand view
oBrw:KeyNo := <nNew>
oBrw:Select(1)
oBrw:Refresh()

If you do not really need multiselect mode for this browse, you can set oBrw:nMarqueeStyle to MARQSTYLE_HIGHLROW and still use oBrw:bClrRowFocus. In such a case multiselect mode is off and oBrw:KeyNo := <new>; oBrw:Refresh() works. ( You can also turn off multiselect mode by setting oBrw:lMultiSelect := .f., but I prefer to use MARQSTYLE_HIGHLROW)

A second question: When i use this selected row i will automatically go to the first editable col and activate it. Which way i shold go?

Though multiselect mode and inline-editing can co-exist they do not comfortably work well together.
Assuming that the browse is not in multiselect mode:
Code: Select all  Expand view

oBrw:KeyNo := <new> // or oBrw:BookMark := <new>
oBrw:Refresh()
oBrw:GoLeftMost()
oBrw:SelectedCol():Edit()

I am assuming that you enabled edit of the left most coulmn, by suitable assignment of oCol:nEditType.

Re: XBROWSE ARRAY go to some ROW

PostPosted: Thu Jun 26, 2014 7:54 am
by byte-one
Mr. Rao, thanks for your help. I found, that i must call a ::Select(0) before ::Select(1) as the "old" selections should erased!
Code: Select all  Expand view

oBrw:KeyNo := <nNew>
oBrw:Select(0)       //NEW
oBrw:Select(1)
oBrw:Refresh()

Re: XBROWSE ARRAY go to some ROW

PostPosted: Thu Jun 26, 2014 9:04 am
by nageswaragunupudi
You are right. Thanks for the correction.