how can i "optimize" Column wide (STRETCHCOL_WIDEST)
how can i SET Cursor into 5th Column (also when outside Screen)
oBrw:nSelCol := 5
oBrw:RefreshCurrent()
[/col]
or use :GoToCol( oCol )
oCol can be creationorder / header / column object
[code]
oBrw:GoToCol( 5 )
nageswaragunupudi wrote:But we can go to only a column which is already visible on the screen. (not hidden or outside the grid width)
nageswaragunupudi wrote:oBrw:GoRight() // one column to the right
oBrw:GoRightMost() // go to last column
oBrw:GoRight() // one column to the right
oBrw:GoRightMost() // go to last column
METHOD GoToCol( oCol ) CLASS TXBrowse
oBro:GoToCol(oBro:aCols[nPosi])
STATIC FUNCTION FindColumnHeader( oBro )
LOCAL aHeaders := {}
LOCAL nPosi := 0
LOCAL n, cSeek, aToken
aToken := AtInside( "+", INDEXKEY() ) // -> hb_ATokens()
// get rid of Function like UPPER() in IndexKey()
cSeek := StripFunc( aToken[ 1 ] )
FOR n := 1 TO LEN( oBro:aCols )
AADD( aHeaders, oBro:aCols[ n ] :cHeader )
NEXT
// seek in Header if FIELD match
nPosi := ASCAN( aHeaders, { | x | x = cSeek } )
IF nPosi > 0
// jump to Column
oBro:GoToCol(oBro:aCols[nPosi])
ENDIF
RETURN nPosi
STATIC FUNCTION StripFunc( cSeek )
LOCAL cRet := UPPER( cSeek )
LOCAL aToken
cRet := STRTRAN( cRet, "UPPER(", "" )
cRet := STRTRAN( cRet, "DTOS(", "" )
cRet := STRTRAN( cRet, "STRZERO(", "" )
cRet := STRTRAN( cRet, "STR(", "" )
cRet := STRTRAN( cRet, ")", "" )
IF "->" $ cRet
aToken := AtInside( "->", cRet )
cRet := aToken[LEN(aToken)]
ENDIF
IF "," $ cRet
aToken := AtInside( ",", cRet )
cRet := aToken[1]
ENDIF
RETURN cRet
in this case this CODE will work where i use INDEXKEY() or OrdKey() to look which FIELD is used
SET ORDER TO TAG "CITY"
nCol := AScan( oBrw:aCols, { |oCol| oCol:cSortOrder == OrdSetFocus() } )
? nCol
oCol := oBrw:aCols[ nCol ]
? oCol:nCreationOrder, oCol:cHeader, c:cExpr
// or even better
XBROWSER oCol
nCol := AScan( oBrw:aCols, { |oCol| oCol:cSortOrder == OrdSetFocus() } )
oCol := oBrw:aCols[ nCol ]
oCol := oBrw:oCol( "cSortOrder", OrdSetFocus() )
XBROWSER oCol
p.s. what is better to use INDEXKEY() or OrdKey()
STATIC FUNCTION StripFunc( cSeek )
nageswaragunupudi wrote:XBrowse automatically uses similar logic to indentify which INDEX/ORDER to be used for which column and stores the INDEXNAME in the data oCol:cSortOrder, while initially building the browse.
XBrowse uses this information to do AutoSort
what about Function in Indexkey() like STRZERO()
but fail when have Function(FIELD)
nageswaragunupudi wrote:Do you want to find the column object that is currently sorted on the ordsetfocus() ?.
nageswaragunupudi wrote:
- Code: Select all Expand view
oBrw:oSortCol --> Currently sorted column obect. i.e., the column sorted on the ordsetfocus()
We can now get anything
oBrw:oSortCol:cHeader
oBrw:oSortCol:cExpr // field name
With XBrowse, most of the times, we do not have to write any special code.
it work when have "only" FIELD Name but seems not when have Function "in" INDEXKEY() / Ordkey()
so i "strip" all of String to get FIELD Name "only"
function FieldInKey( cKey )
local aStruct := DBSTRUCT()
local n := 1
local cToken, cSep, nAt
cKey := Upper( cKey )
cKey := StrTran( StrTran( cKey, "->", '!' ), '=', '!' )
cKey := CharRem( " ", cKey )
do while !Empty( cToken := TOKEN( cKey, nil, n, nil, nil, @cSep ) )
if !( cSep $ "!(" )
if ( nAt := AScan( aStruct, { |a| a[ 1 ] = cToken } ) ) > 0
return aStruct[ nAt, 1 ]
endif
endif
n++
enddo
return ""
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: SantaCroya and 38 guests