FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse - dumb question
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
xBrowse - dumb question
Posted: Wed Jun 26, 2013 04:14 PM

Hello Everyone,

Sorry for asking this question, I have not been able to find exact answer on forum or in sample code.

  1. How do I highlight entire xBrowse row? At this point I am only able to highlight individual cells.

  2. I am using ADO to connect to SQL, after I insert a new record, I would like cursor position of recordset to move the newly corrected record, how do I do that?

  3. Also related to ADO, when I exit a data entry and return to recordset, how do I move cursor to record that was just selected.

Thank you in advance for your patience and assistance

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse - dumb question
Posted: Wed Jun 26, 2013 05:26 PM

Darrell,

  1. oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse - dumb question
Posted: Wed Jun 26, 2013 05:30 PM
Darrell,

2. Basically you have to do this (thats what we do and works in FWH samples FiveDBU.prg):

Code (fw): Select all Collapse
function RSAppendBlank( oRS )

   local n, aValues := {}

   oRS:MoveLast()

   for n = 1 to oRS:Fields:Count
      AAdd( aValues, oRS:Fields[ n - 1 ]:Value )
      if n == 1 .and. ValType( aValues[ 1 ] ) == "N"
         aValues[ 1 ]++
      else
         aValues[ n ] = uValBlank( aValues[ n ] )
         if ValType( aValues[ n ] ) == "D" .and. Empty( aValues[ n ] )
            aValues[ n ] = Date()
         endif              
      endif
   next

   oRS:AddNew()

   for n = 1 to oRS:Fields:Count
      if n == 1 
         if ! ValType( aValues[ n ] ) == "N"
            oRS:Fields[ n - 1 ]:Value = aValues[ n ]
         endif
      else   
         oRS:Fields[ n - 1 ]:Value = aValues[ n ]
      endif   
   next
   
   oRS:Update()

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: xBrowse - dumb question
Posted: Wed Jun 26, 2013 05:31 PM
Daniel

1. How do I highlight entire xBrowse row? At this point I am only able to highlight individual cells.

Code (fw): Select all Collapse
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROW


2. I am using ADO to connect to SQL, after I insert a new record, I would like cursor position of recordset to move the newly corrected record, how do I do that?

3. Also related to ADO, when I exit a data entry and return to recordset, how do I move cursor to record that was just selected.


A small snipit of code .. on Add .. assign a variable to your rows primary key then moveFirst and Find your primary key .. then oLbx:ReFresh() .. That will take you to your new row.

Rick Lipkin
Code (fw): Select all Collapse
IF cMODE = "A"

   nEID := _GenEid()  // create a unique primary key or you can use AutoNumber or Counter
   IF nEID = -1
      RETURN(.F.)
   ENDIF

   oRsEmp:AddNew()
   oRsEmp:Fields("StaffNo"):Value     := nEID

ENDIF

oRsEmp:Fields("UserId"):Value     := cUserId
oRsEmp:Fields("FName"):Value      := UpperLower(cFName)
oRsEmp:Fields("LName"):Value      := UpperLower(cLName)
oRsEmp:Fields("Password"):Value   := Encrypt(cPassword)

oRsEmp:Update()


IF cMODE = "A"
   oRsEmp:Sort := "Lname"
   oRsEmp:MoveFirst()
   oRsEmp:Find( "StaffNo = "+ltrim(str(nEID)) )  // new row
ENDIF

oLbx:ReFresh()

RETURN(NIL)
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: xBrowse - dumb question
Posted: Wed Jun 26, 2013 05:37 PM

Darrell,

  1. You use bookmarks. Basically:

local nAt := oRs:BookMark

...

oRs:BookMark = nAt

FWH xbrowse provides a Method that automatizes all that (including the refresh of the browse):

local nAt := oBrw:BookMark

...

oBrw:BookMark := nAt

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: xBrowse - dumb question
Posted: Wed Jun 26, 2013 06:00 PM

Awesome!

Thank you so much!

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com

Continue the discussion