Perhaps there is something changed
this is the original test of Nages
- Code: Select all Expand view
//----------------------------------------------------------------------------//
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"
//----------------------------------------------------------------------------//
REQUEST DBFCDX
//----------------------------------------------------------------------------//
function Test2
local oDlg, oBrw, oFont
USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
GO TOP
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,400 PIXEL FONT oFont
@ 10,10 XBROWSE oBrw SIZE -10,-30 PIXEL OF oDlg ;
DATASOURCE "CUST" ;
COLUMNS "First", "Last", "State", "Salary" ;
HEADERS "Name", "SurName", "State", "Salary" ;
CELL LINES FASTEDIT NOBORDER
oBrw:CreateFromCode()
@ 180, 10 BUTTON "VertBrw" SIZE 40,12 PIXEL OF oDlg ACTION XbrVert( oBrw )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
CLOSE CUST
return nil
//----------------------------------------------------------------------------//
function XBrVert( oMain )
local oDlg, oBrw, oFont
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 600,600 PIXEL FONT oFont
@ 10, 10 XBROWSE oBrw SIZE 280,280 PIXEL OF oDlg ;
DATASOURCE oMain:aCols ;
COLUMNS { || oBrw:aRow:cHeader }, { || oBrw:aRow:Value } ;
HEADERS "Column", "ColumnValue" ;
CELL LINES NOBORDER FASTEDIT UPDATE
WITH OBJECT oBrw
:lHScroll := .f.
oBrw:aCols[ 1 ]:bClrStd := { || { CLR_BLACK, oBrw:nRecSelColor } }
WITH OBJECT oBrw:aCols[ 2 ]
:nEditType := EDIT_GET
:bOnPostEdit := { |o,x,n| If( n != VK_ESCAPE, oBrw:aRow:VarPut( x ), nil ) }
:bOnChange := { || oMain:RefreshCurrent() }
END
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED ON INIT DlgInit( oBrw )
RELEASE FONT oFont
oMain:Refresh()
oMain:SetFocus()
return nil
//----------------------------------------------------------------------------//
static function DlgInit( oBrw )
local oDlg := oBrw:oWnd
local aDim := { oBrw:nWidth, oBrw:nHeight }
// ----- RESIZE DIALOG TO FIT THE CONTENTS OF BROWSE -------//
oBrw:BrwFitSize( .t. )
if oBrw:nWidth < 284
oBrw:nWidth := 284
oBrw:nStretchCol := 2
endif
oDlg:nWidth += ( oBrw:nWidth - aDim[ 1 ] )
oDlg:nHeight += ( oBrw:nHeight - aDim[ 2 ] )
WITH OBJECT oBrw
:ColStretch()
:oWnd:Center()
:SetFocus()
END
return .f.
//----------------------------------------------------------------------------//