This is a working sample for FWH versions older than FWH1810. I have tested this sample with FWH1602 and is working well.
For the old versions I used
after changing the filter of oRs.
This sample gives exactly the same results as shown in the above animated gif.
Code: Select all
#include "fivewin.ch"
// FOR FWH VERSIONS PRIOR TO FWH1806
static oCn
//----------------------------------------------------------------------------//
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd MDI
DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
DEFINE BUTTON OF oBar PROMPT "Browse" ACTION MdiDlg()
DEFINE BUTTON OF oBar PROMPT "Close" ACTION oWnd:End()
ACTIVATE WINDOW oWnd
if oCn != nil
oCn:Close()
end
return nil
//----------------------------------------------------------------------------//
static function MdiDlg()
local oRs, oDlg, oWnd, oBrw, oFont, oRad
local nState := 1
local aStates := { " ", "NY", "WA" }
DEFAULT oCn := FW_OpenAdoConnection( "xbrtest.mdb" )
oRs := FW_OpenRecordSet( oCn, "customer" )
oRs:Filter := "STATE=NULL"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE DIALOG oDlg SIZE 650,400 PIXEL TRUEPIXEL FONT oFont
RELEASE FONT oFont
@ 48,0 XBROWSE oBrw SIZE 500,0 PIXEL OF oDlg ;
DATASOURCE oRs COLUMNS "FIRST","CITY","STATE" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:CreateFromCode()
END
@ 050,520 RADIO oRad VAR nState ITEMS "None", "NY", "WA" ;
SIZE 80,20 PIXEL OF oDlg ON CHANGE ( ;
oRs:Filter := If( nState == 1, "STATE=NULL", "STATE='" + aStates[ nState ] + "'" ), ;
oBrw:Refresh(), oDlg:oBar:AEvalWhen() )
DEFINE WINDOW oWnd MDICHILD OF WndMain() TITLE "Dialog"
ACTIVATE DIALOG oDlg NOWAIT ;
ON INIT ( BuildBar( oDlg, oBrw ), ChangeParent( oDlg, oWnd ) )
oDlg:End()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
static function BuildBar( oDlg, oBrw )
local oBar
DEFINE BUTTONBAR oBar OF oDlg SIZE 80,48 2007
DEFINE BUTTON OF oBar PROMPT "Add" FILE "c:\fwh\bitmaps\new2.bmp" ;
ACTION oBrw:EditSource( .t. )
DEFINE BUTTON OF oBar PROMPT "Modify" FILE "c:\fwh\bitmaps\edit.bmp" ;
WHEN oBrw:oRs:RecordCount() > 0 ACTION oBrw:EditSource()
DEFINE BUTTON OF oBar PROMPT "Delete" FILE "c:\fwh\bitmaps\16x16\delete.bmp" ;
WHEN oBrw:oRs:RecordCount() > 0 ACTION oBrw:Delete()
return nil
//----------------------------------------------------------------------------//
static function ChangeParent( oDlg, oWnd )
local oControl
for each oControl in oDlg:aControls
SetParent( oControl:hWnd, oWnd:hWnd )
AAdd( oWnd:aControls, oControl )
oControl:oWnd := oWnd
next
oWnd:SetSize( oDlg:nWidth, oDlg:nHeight )
oWnd:SetColor( oDlg:nClrText, oDlg:nClrPane, oDlg:oBrush )
return nil
//----------------------------------------------------------------------------//