Showing current record on initial browse in middle of displa

This forum is for eXpress++ general support.
Post Reply
Message
Author
Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Showing current record on initial browse in middle of displa

#1 Post by Cliff Wiernik »

If you happen to be at or near the end of the logical ordering of records in a browse, when you initially display the browse, that record happens to be at the end of the browse. If there are more records above the current record point, I would like to display the initial browse so that the current record appears in the middle of the browse data area. I would like to have the record point still remain on the current record. That way you can see some of the records above and below the current record are displayed.

Is there an easy way to do this.

Cliff.

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

Re: Showing current record on initial browse in middle of di

#2 Post by rdonnay »

This test program works pretty good for me.

Code: Select all

#INCLUDE "dcdialog.CH"

FUNCTION Main()

LOCAL GetList[0], GetOptions, oBrowse

USE \exp19\data\xtest

GO 500

@ 0,0 DCBROWSE oBrowse ALIAS 'XTEST' SIZE 50,20 FIT ;
   FONT '10.Lucida Console'

DCBROWSECOL DATA {||XTEST->(RecNo())} HEADER 'Record' WIDTH 6 PARENT oBrowse PICTURE '99999'
DCBROWSECOL FIELD XTEST->exchange HEADER 'Exch' WIDTH 4 PARENT oBrowse
DCBROWSECOL FIELD XTEST->areacode HEADER 'Area' WIDTH 4 PARENT oBrowse
DCBROWSECOL FIELD XTEST->number HEADER 'Number' WIDTH 4 PARENT oBrowse
DCBROWSECOL FIELD XTEST->city HEADER 'City' WIDTH 30 PARENT oBrowse

DCREAD GUI FIT TITLE 'Browse Test' EVAL {||AdjustRow(oBrowse)}

RETURN nil

* ----------

PROC appsys ; return

* ----------

FUNCTION AdjustRow( oBrowse )

LOCAL nSaveRec, i

nSaveRec := (oBrowse:dataSource)->(RecNo())

oBrowse:goBottom()
oBrowse:forceStable()
FOR i := 1 TO oBrowse:rowCount/2
  oBrowse:up()
NEXT
oBrowse:forceStable()
(oBrowse:dataSource)->(dbGoto(nSaveRec))
oBrowse:refreshAll()

RETURN nil
The eXpress train is coming - and it has more cars.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Showing current record on initial browse in middle of di

#3 Post by Cliff Wiernik »

Thanks. Works like a charm. Didn't think about using :forcestable().

See you at the Dev Con. Arriving on Wednesday.

Cliff

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

Re: Showing current record on initial browse in middle of di

#4 Post by rdonnay »

I'm glad it worked for you.

See you next month.
The eXpress train is coming - and it has more cars.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Showing current record on initial browse in middle of di

#5 Post by Cliff Wiernik »

Had to modify it a bit when you had a small number of records, it was not staying on the original record. But you gave me the right direction.

Cliff.

Post Reply