Page 1 of 1
DCBrowse Row First Highlighted
Posted: Tue Oct 11, 2011 8:46 am
by GeneB
DC_ACHOICE has an argument "nInitialItem" to select the item to highlight in the window on startup.
For DC_BROWSE is there a similar way to highlight a row so that the first row at the top of the browse is not the one highlighted when the browse is started?
Re: DCBrowse Row First Highlighted
Posted: Tue Oct 11, 2011 11:53 am
by rdonnay
You would need to use the navigation methods of the browse object to do this.
Code: Select all
oBrowse:down()
oBrowse:down()
oBrowse:down()
oBrowse:forceStable()
This will highlight the 3rd row.
Re: DCBrowse Row First Highlighted
Posted: Wed Oct 12, 2011 1:22 am
by reganc
rdonnay wrote:You would need to use the navigation methods of the browse object to do this.
Code: Select all
oBrowse:down()
oBrowse:down()
oBrowse:down()
oBrowse:forceStable()
This will highlight the 3rd row.
Or even the 4th row.

Sorry, Roger, I couldn't resist...
Gene, you can put the code in the eval codeblock of either the DCBROWSE or the DCREAD.
Re: DCBrowse Row First Highlighted
Posted: Wed Oct 12, 2011 1:41 am
by Tom
Alternative: If you're browsing a database, just move to the record to be highlighted inside the EVAL clause of DCREAD, put an oBrowse:RefreshAll() behind. If you're browsing an array, set the pointer value in oBrowse:ArrayElement (iVar), also refresh afterwards. But: this may force the browse to scroll.
Re: DCBrowse Row First Highlighted
Posted: Fri Oct 14, 2011 12:16 pm
by GeneB
What worked the best was an EVAL in the DCREAD, with three oBrowse:down() commands and a refresh.
I did discover that I had to initially define the pointer as 1 to make it work.
I am using this for users to enter a list of items to print price tags. If I use MODE DCGUI_BROWSE_EDITACROSSDOWN_APPEND in DCBROWSE, the touch typists can enter the items quickly without reaching for a mouse. However, the browse begins on the first row and when the enter key is pressed after entering the first item the browse scrolls upward making the item just entered move upwards out of the visible browse screen. Beginning four lines down eliminated a lot of complaints.
If there is a better way to 'handle' this I would like to hear it, but this seems to work.
Thanks to everyone for their input.
GeneB
Re: DCBrowse Row First Highlighted
Posted: Mon Oct 17, 2011 4:51 am
by Tom
I stopped using the POINTER clause of DCBROWSE. If you need an array pointer, use DC_BrowseRow() instead. It seems to me more reliable.
Re: DCBrowse Row First Highlighted
Posted: Tue Oct 18, 2011 7:13 pm
by rdonnay
oBrowse:arrayElement reliably returns the array pointer.
oBrowse:dataSource[oBrowse:arrayElement] will return an array with the contents of the current row.