I am not a expert in arrays .. I have created an array with three elements and I have been able to get it sorted properly and been able to find a specific name in the array ..
When I load the array after it has found my row .. xbrowse automatically goes to the top of the array and apparently 'moves' the record pointer.
How can I move the record pointer to a specific row in xBrowse .. or not have xBrowse move the record pointer ?
Here is my code .. sorry for my ignorance.
Rick Lipkin
- Code: Select all Expand view
oRsVendor := TOleAuto():New( "ADODB.Recordset" )
oRsVendor:CursorType := 1 // opendkeyset
oRsVendor:CursorLocation := 3 // local cache
oRsVendor:LockType := 3 // lockoportunistic
cSQL := "SELECT * From Avendor Order by Lname,Fname"
TRY
oRsVendor:Open( cSQL,xCONNECT )
CATCH oErr
MsgInfo( "Error in Opening AVENDOR table" )
RETURN(.F.)
END TRY
aVendor := {}
If oRsVendor:Eof
Else
oRsVendor:MoveFirst()
Do While .not. oRsVendor:Eof
cName := substr(alltrim(dencrypt(oRsVendor:Fields("Lname"):Value))+", "+;
alltrim(dencrypt(oRsVendor:Fields("Fname"):Value))+" "+;
alltrim(dencrypt(oRsVendor:Fields("Mname"):Value))+space(45),1,45)
aLine := { cName,;
dencrypt(oRsVendor:Fields("Active"):Value),;
oRsVendor:Fields("AvendorEid"):Value }
AAdd( aVendor, aLine )
oRsVendor:MoveNext()
Enddo
oRsVendor:MoveFirst()
Endif
aSort( aVendor,,, { |x,y| x[1] < y[1] } )
*xBrowse( aVendor )
xLname := alltrim(cLname)
*msginfo( xLname )
If Len(aVendor) > 0
nAt := Ascan( aVendor, {|aVal| aVal[1] = xLname } )
msginfo( nAt )
For i = 1 to Len( aVendor )
If i = nAt
msginfo( "Found" )
Exit
Endif
Next
Endif
lOk2 := .f.
xTITLE := "Emp Browse "
DEFINE WINDOW oWndChild2 MDICHILD ;
FROM 7,7 to 28,55 ;
MENU BuildMenu() ;
NOSYSMENU ;
NOMINIMIZE ;
NOZOOM ;
OF oWind ;
TITLE xTITLE
DEFINE DIALOG oDlg2 RESOURCE "EMPBROW" OF oWndChild2 ;
COLOR RGB(192,192,192), RGB(62,104,130)
REDEFINE xBROWSE oLBX2 ;
COLUMNS 1,2 ;
HEADERS "Serial Number" ;
COLSIZES 200,165 ;
ARRAY aVendor ;
ID 111 of oDlg2 ;
AUTOSORT AUTOCOLS LINES CELL
oLbx2:lHScroll := .f. // turn off horiz scroll bar
oLbx2:lRecordSelector := .f.
* oLbx2:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
oLbx2:nMarqueeStyle := MARQSTYLE_HIGHLROW