oBrw:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
#include "FiveWin.ch"
#include "XBrowse.ch"
function Main()
local oWnd, oBrw, aData := { { PadR( "One", 10 ), PadR( "Two", 10 ), PadR( "Three", 10 ) },;
{ "Four", "Five", "Six" } }
DEFINE WINDOW oWnd TITLE "XBrowse"
@ 0, 0 XBROWSE oBrw ARRAY aData AUTOCOLS // FOOTERS
oBrw:aCols[ 1 ]:cHeader = "Header1"
oBrw:aCols[ 2 ]:cHeader = "Header2"
oBrw:aCols[ 3 ]:cHeader = "Header3"
// oBrw:aCols[ 1 ]:cFooter = "Header1"
// oBrw:aCols[ 2 ]:cFooter = "Header2"
// oBrw:aCols[ 3 ]:cFooter = "Header3"
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd ;
ON INIT Inspect( oBrw )
return nil
function Inspect( oControl )
local oWnd, oBrw
local aData := { { "Marquee", "SolidCell", EDIT_LISTBOX,;
{ "NoMarquee", "DotedCell", "SolidCell", "HighLCell", "HightLRowRC", "HighLRow", "HighLRowMS" },;
{ | oCol, uVal, nKey | If( nKey != VK_ESCAPE, ( aData[ oBrw:nArrayAt ][ 2 ] := uVal, uVal := AScan( oCol:aEditListTxt, uVal ) - 1, oControl:nMarqueeStyle := uVal, oControl:Refresh() ),) } },;
{ "Columns", "<objects>", EDIT_LISTBOX, GenColumnsList( oControl ),;
{ | oCol, uVal, nKey | If( nKey != VK_ESCAPE, SelColumn( oBrw, oControl, uVal ),) } } }
DEFINE WINDOW oWnd TITLE "Object inspector" FROM 10, 10 TO 40, 48
oWnd:ToolWindow()
@ 0, 0 XBROWSE oBrw ARRAY aData COLUMNS 1, 2 COLSIZES 100, 140 ;
ON CHANGE SetEditType( oBrw, aData )
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
// oBrw:lFastEdit = .T. only compatible with MARQSTYLE_HIGHLCELL
// oBrw:nStretchCol = 2 // crashes with EDIT_LISTBOX and EDIT_BUTTON for now
oBrw:aCols[ 1 ]:cHeader = "Property"
oBrw:aCols[ 2 ]:cHeader = "Value"
// oBrw:lRecordSelector := .F.
oBrw:aCols[ 1 ]:bLDClickData = { || oBrw:aCols[ 2 ]:Edit() }
oWnd:oClient = oBrw
oWnd:bReSized = { || oBrw:aCols[ 2 ]:nWidth := oWnd:nWidth - oBrw:aCols[ 1 ]:nWidth - 63 }
oWnd:Show()
return nil
function SetEditType( oBrw, aData )
local nEditType := aData[ oBrw:nArrayAt ][ 3 ]
local oCol := oBrw:aCols[ 2 ]
oCol:nEditType := nEditType
do case
case nEditType == EDIT_LISTBOX
oCol:aEditListTxt = aData[ oBrw:nArrayAt ][ 4 ]
oCol:aEditListBound = aData[ oBrw:nArrayAt ][ 4 ] // remove this if you want the index, not the string
if ! Empty( aData[ oBrw:nArrayAt ][ 5 ] )
oCol:bOnPostEdit = aData[ oBrw:nArrayAt ][ 5 ]
endif
case nEditType == EDIT_BUTTON
oCol:bEditBlock = aData[ oBrw:nArrayAt ][ 4 ] // whatever is returned by the codeblock, it will be asigned
endcase
return nil
function SelectColumn( oBrw, oControl, aData )
aData := { { "Header", oControl:aCols[ 1 ]:cHeader, EDIT_GET } }
oBrw:aCols := nil
oBrw:SetArray( aData )
oBrw:aCols[ 2 ]:bOnPostEdit = nil
oBrw:Refresh()
return oControl:aCols[ 1 ]:cHeader
function GenColumnsList( oBrw )
local aData := {}, n
for n = 1 to Len( oBrw:aCols )
AAdd( aData, "Column " + AllTrim( Str( n ) ) )
next
return aData
function SelColumn( oBrwInsp, oBrw, uVal )
MsgInfo( uVal )
return uVal
#include "FiveWin.ch"
#include "XBrowse.ch"
function Main()
local oWnd, oBrw, aData := { { PadR( "One", 10 ), PadR( "Two", 10 ), PadR( "Three", 10 ) },;
{ "Four", "Five", "Six" } }
DEFINE WINDOW oWnd TITLE "XBrowse"
@ 0, 0 XBROWSE oBrw ARRAY aData AUTOCOLS // FOOTERS
oBrw:aCols[ 1 ]:cHeader = "Header1"
oBrw:aCols[ 2 ]:cHeader = "Header2"
oBrw:aCols[ 3 ]:cHeader = "Header3"
// oBrw:aCols[ 1 ]:cFooter = "Header1"
// oBrw:aCols[ 2 ]:cFooter = "Header2"
// oBrw:aCols[ 3 ]:cFooter = "Header3"
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd ;
ON INIT InspectBrowse( oBrw )
return nil
function InspectBrowse( oBrw )
local aProps := {}, oProp
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Marquee"
oProp:nEditType = EDIT_LISTBOX
oProp:bValues = { || { "NoMarquee", "DotedCell", "SolidCell", "HighLCell", "HightLRowRC", "HighLRow", "HighLRowMS" } }
oProp:bOnRead = { | oProp | oProp:GetLabel( oBrw:nMarqueeStyle + 1 ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | uValue := oProp:GetIndex( uValue ), If( nKey != VK_ESCAPE, ( oBrw:nMarqueeStyle := uValue - 1, oBrw:Refresh() ),) }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Columns"
oProp:nEditType = EDIT_LISTBOX
oProp:bValues = { || GenColumnsList( oBrw ) }
oProp:bOnRead = { | oProp | "<array>" }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | MsgInfo( uValue ) }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Top"
oProp:nEditType = EDIT_GET
oProp:bOnRead = { | oProp | Str( oBrw:nTop ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | oProp:nTop := uValue }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Left"
oProp:nEditType = EDIT_GET
oProp:bOnRead = { | oProp | Str( oBrw:nLeft ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | oProp:nLeft := uValue }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Width"
oProp:nEditType = EDIT_GET
oProp:bOnRead = { | oProp | Str( oBrw:nWidth ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | oProp:nWidth := uValue }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "Height"
oProp:nEditType = EDIT_GET
oProp:bOnRead = { | oProp | Str( oBrw:nHeight ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | oProp:nHeight := uValue }
AAdd( aProps, oProp := TProperty():New() )
oProp:oObject = oBrw
oProp:cName = "ArrayAt"
oProp:nEditType = EDIT_GET
oProp:bOnRead = { | oProp | Str( oBrw:nArrayAt ) }
oProp:bOnWrite = { | oProp, oCol, uValue, nKey | oProp:nArrayAt := uValue }
Inspect( oBrw, aProps )
return nil
function Inspect( oControl, aProps )
local oWnd, oBrw, aData := {}, n
for n = 1 to Len( aProps )
AAdd( aData, { aProps[ n ]:cName, "" } )
next
DEFINE WINDOW oWnd TITLE "Object inspector" FROM 10, 10 TO 40, 48
oWnd:ToolWindow()
@ 0, 0 XBROWSE oBrw ARRAY aData COLUMNS 1, 2 COLSIZES 100, 140 ;
ON CHANGE SetEditType( oBrw, aProps )
oBrw:aCols[ 2 ]:bStrData = { || Eval( aProps[ oBrw:nArrayAt ]:bOnRead, aProps[ oBrw:nArrayAt ] ) }
oBrw:aCols[ 2 ]:nEditType = aProps[ oBrw:nArrayAt ]:nEditType
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
// oBrw:lFastEdit = .T. only compatible with MARQSTYLE_HIGHLCELL
// oBrw:nStretchCol = 2 // crashes with EDIT_LISTBOX and EDIT_BUTTON for now
oBrw:aCols[ 1 ]:cHeader = "Property"
oBrw:aCols[ 2 ]:cHeader = "Value"
// oBrw:lRecordSelector := .F.
oBrw:aCols[ 1 ]:bLDClickData = { || oBrw:aCols[ 2 ]:Edit() }
oControl:bResized = { || oBrw:Refresh() }
oControl:bChange = { || oBrw:Refresh() }
oWnd:oClient = oBrw
oWnd:bReSized = { || oBrw:aCols[ 2 ]:nWidth := oWnd:nWidth - oBrw:aCols[ 1 ]:nWidth - 63 }
oWnd:Show()
return nil
function SetEditType( oBrw, aProps )
local oProp := aProps[ oBrw:nArrayAt ]
local nEditType := oProp:nEditType
local oCol := oBrw:aCols[ 2 ]
oCol:nEditType( nEditType )
do case
case nEditType == EDIT_GET
case nEditType == EDIT_LISTBOX
oCol:aEditListTxt = Eval( oProp:bValues )
oCol:aEditListBound = Eval( oProp:bValues ) // remove this if you want the index, not the string
oCol:bOnPostEdit = { | oCol, uValue, nKey | Eval( oProp:bOnWrite, oProp, oCol, uValue, nKey ) }
case nEditType == EDIT_BUTTON
oCol:bEditBlock = oProp:bOnWrite // whatever is returned by the codeblock, it will be asigned
endcase
return nil
function SelectColumn( oBrw, oControl, aData )
aData := { { "Header", oControl:aCols[ 1 ]:cHeader, EDIT_GET } }
oBrw:aCols := nil
oBrw:SetArray( aData )
oBrw:aCols[ 2 ]:bOnPostEdit = nil
oBrw:Refresh()
return oControl:aCols[ 1 ]:cHeader
function GenColumnsList( oBrw )
local aData := {}, n
for n = 1 to Len( oBrw:aCols )
AAdd( aData, "Column " + AllTrim( Str( n ) ) )
next
return aData
function SelColumn( oBrwInsp, oBrw, uVal )
MsgInfo( uVal )
return uVal
CLASS TProperty
DATA oObject
DATA cName
DATA bValues
DATA nEditType
DATA bOnRead
DATA bOnWrite
METHOD New() INLINE Self
METHOD GetLabel( nIndex ) INLINE Eval( ::bValues )[ nIndex ]
METHOD GetIndex( uValue ) INLINE AScan( Eval( ::bValues ), uValue )
ENDCLASS
nageswaragunupudi wrote:Mr JC
>
liked very much this style of selected row on xBrowse!
It is the MARQSTYLE_HIGHLROWRC style, but when I try to use this style into my application... it don't have the same effect!
>
Answer to your question is in the testxbrw3.prg source itself.
- Code: Select all Expand view RUN
oBrw:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
I do not know if this was implemented in version 8.05. You may try the above code and try.
You will learn more from studying the source code of testxbrw3.prg ( The way I learnt )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], Marc Venken and 97 guests