XBROWSE ARRAY go to some ROW

XBROWSE ARRAY go to some ROW

Postby avista » Sat Jun 21, 2014 1:25 am

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,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE ARRAY go to some ROW

Postby nageswaragunupudi » Sat Jun 21, 2014 1:54 am

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()
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE ARRAY go to some ROW

Postby cnavarro » Sat Jun 21, 2014 6:39 am

Mr Rao
It could include one xbrowse Method goRec( nRec ) to do this?
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6504
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: XBROWSE ARRAY go to some ROW

Postby avista » Mon Jun 23, 2014 6:57 am

Thanks Rao,

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

Best regards,
User avatar
avista
 
Posts: 301
Joined: Fri Jun 01, 2007 9:07 am
Location: Macedonia

Re: XBROWSE ARRAY go to some ROW

Postby byte-one » Mon Jun 23, 2014 1:04 pm

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.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE ARRAY go to some ROW

Postby nageswaragunupudi » Mon Jun 23, 2014 2:28 pm

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE ARRAY go to some ROW

Postby byte-one » Tue Jun 24, 2014 11:48 am

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!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE ARRAY go to some ROW

Postby nageswaragunupudi » Tue Jun 24, 2014 9:14 pm

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSE ARRAY go to some ROW

Postby byte-one » Thu Jun 26, 2014 7:54 am

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()
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: XBROWSE ARRAY go to some ROW

Postby nageswaragunupudi » Thu Jun 26, 2014 9:04 am

You are right. Thanks for the correction.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10317
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests