// An object inspector using XBrowse
// (c) FiveTech Software 2008
#include "FiveWin.ch"
#include "XBrowse.ch"
function Main()
local oWnd, oBrw
local aData := { { "A edit", "text", EDIT_GET },;
{ "A combobox", "test", EDIT_LISTBOX, { "One", "Two", "Three" } },;
{ "A dialog", "result", EDIT_BUTTON, { || MsgYesNo( "Select a value" ) } } }
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.
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd ;
ON RESIZE oBrw:aCols[ 2 ]:nWidth := oWnd:nWidth - oBrw:aCols[ 1 ]:nWidth - 63
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
case nEditType == EDIT_BUTTON
oCol:bEditBlock = aData[ oBrw:nArrayAt ][ 4 ] // whatever is returned by the codeblock, it will be asigned
endcase
return nil
METHOD KeyChar( nKey, nFlags ) CLASS TXBrowse
...
if ::bKeyChar != nil
Eval( ::bKeyChar, nKey, nFlags )
if ::lEditMode // nuevo
return nil // nuevo
endif // nuevo
endif
...
METHOD RunBtnAction() CLASS TXBrwColumn
...
::oBrw:lEditMode := .T. // nuevo!
::PostEdit( Eval( ::bEditBlock, nRow, nCol, Self ), .t. )
return .T.
oBrw:bEditType := { || selecValor( oBrw, @xOpcion ) }
function selecValor( oBrw, xOpcion )
local nEdit := EDIT_GET
DO CASE
CASE oBrw:aRow[ 1 ] in { "REG4", "REG9", "REG11" }
nEdit := EDIT_LISTBOX
xOpcion := { "Uno", "Dos", "Tres" }
CASE oBrw:aRow[ 1 ] == "REG8"
nEdit := EDIT_LISTBOX
xOpcion := { "aaa", "bbb", "ccc" }
CASE oBrw:aRow[ 1 ] == "REG15"
nEdit := EDIT_BUTTON
xOpcion := { || MsgYesNo( "Select a value" ) }
ENDCASE
return nEdit
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 46 guests