DCBrowse Row First Highlighted

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

DCBrowse Row First Highlighted

#1 Post 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?

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBrowse Row First Highlighted

#2 Post 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.
The eXpress train is coming - and it has more cars.

reganc
Posts: 257
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBrowse Row First Highlighted

#3 Post 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.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
Tom
Posts: 1172
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBrowse Row First Highlighted

#4 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: DCBrowse Row First Highlighted

#5 Post 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

User avatar
Tom
Posts: 1172
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DCBrowse Row First Highlighted

#6 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBrowse Row First Highlighted

#7 Post by rdonnay »

oBrowse:arrayElement reliably returns the array pointer.

oBrowse:dataSource[oBrowse:arrayElement] will return an array with the contents of the current row.
The eXpress train is coming - and it has more cars.

Post Reply