FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse : aBarGetlist reposition record after change
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Xbrowse : aBarGetlist reposition record after change
Posted: Thu Mar 07, 2019 09:57 PM
Hello,

In a XBrowse, I have a (field) or object:Groep that contains data like ex. Cities
I have a index on that field in order to show them sorted by city.
I then have a array of all posible cities and I choise them from the pulldown menu.

At that point totaly normal, the position of the Xbrowse changes to the new cities.
I want to go to the next record that I have been editing before.

How do I proceed ?


Code (fw): Select all Collapse
   WITH OBJECT :groep
      :nEditType     := EDIT_LISTBOX
      :aEditListTxt  := aGroepen

      //:bPopUp        := { |o| ColMenu( o ) }

      :aBarGetList:= aGroepen
      //:cSortOrder = "groep"
   ENDWITH
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Xbrowse : aBarGetlist reposition record after change
Posted: Thu Mar 07, 2019 10:34 PM
Almost there...only oBrw:goto() does not work yet

Code (fw): Select all Collapse
   WITH OBJECT :groep
      :nEditType     := EDIT_LISTBOX
      :aEditListTxt  := aGroepen
      :bOnChange := { |oCol, uOldVal| OnGroepChange( oBrw[1], oCol, uOldVal ) }

      //:bPopUp        := { |o| ColMenu( o ) }

      :aBarGetList:= aGroepen
      //:cSortOrder = "groep"
   ENDWITH


Code (fw): Select all Collapse
function OnGroepChange( oBrw, oCol, uOldVal )
  //xbrowser(oBrw)
  //oBrw:GoTop()
  nRecno = oBrw:BookMark
  msginfo(nRecno)
  //oBrw:GoDown()
  oBrw:Goto(nRecNo)
  oBrw:refresh()
return NIL
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Xbrowse : aBarGetlist reposition record after change
Posted: Thu Mar 07, 2019 10:55 PM
No error, but he goes to the record afther editing.

Code (fw): Select all Collapse
function OnGroepChange( oBrw, oCol, uOldVal )
  nRecno = oBrw:BookMark
  msginfo(nRecno)
  oBrw:bKeyNo := oBrw:bBookMark
  oBrw:refresh()
return NIL
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse : aBarGetlist reposition record after change
Posted: Fri Mar 08, 2019 02:39 AM

nRecNo := oBrw:BookMark

oBrw:BookMark := nRecNo

Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Xbrowse : aBarGetlist reposition record after change
Posted: Fri Mar 08, 2019 04:14 PM

I have to store the recno of the Xbrowse before I edit the record.

Xbrowse executes agetbarlist first and then it executed bonchange event as far as I can tell, because the bookmark I get is the one on the new position (afther the change)

Therefore I can not get back to the previous recno.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Xbrowse : aBarGetlist reposition record after change
Posted: Sun Mar 10, 2019 11:26 PM

Try oCol:oBarGet:bGotFocus

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion