function BrowseDlg( cDBF )
local oDlg, oBrw, cAlias
USE ( cDbf ) NEW SHARED ALIAS ( cAlias := cGetNewAlias( "DB" ) ) VIA "DBFCDX"
if !USED()
? "Can not open " + cDBF
return nil
endif
DEFINE DIALOG oDlg SIZE 600,400 PIXEL
@ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
ALIAS cAlias AUTOCOLS CELL LINES NOBORDER FASTEDIT
WITH OBJECT oBrw
// other settings
//
:CreateFromCode()
END
ACTIVATE DIALOG oDlg NOMODAL ;
VALID ( ( cAlias )->( DBCLOSEAREA() ), .t. )
return nil
#include "FiveWin.Ch"
#include "xbrowse.ch"
STATIC oWnd
STATIC nCount := 0
FUNCTION Main()
LOCAL oBar
CreateTable()
DEFINE WINDOW oWnd MDI
DEFINE BUTTONBAR oBar
DEFINE BUTTON OF oBar ACTION Dlg()
ACTIVATE WINDOW oWnd ON INIT Test()
RETU NIL
FUNCTION Dlg()
LOCAL oDlg, oBrw, cAlias
cAlias := 'MIALIAS' + ltrim(str(++nCount))
USE "xbr.dbf" SHARED NEW ALIAS (cAlias )
DEFINE DIALOG oDlg TITLE ( 'Browse => ' + cAlias )
oDlg:nStyle := nOr( WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX )
@ 0,0 XBROWSE oBrw OF oDlg ALIAS (cAlias) AUTOCOLS
oBrw:CreateFromCode()
oDlg:oClient := oBrw
ACTIVATE DIALOG oDlg NOMODAL ;
ON INIT ( oDlg:Move( HB_RandomInt(5) * 100 , HB_RandomInt(10) * 100 ) ) ;
VALID ( (cAlias)->(DbCloseArea()), .t. )
RETU NIL
FUNCTION Test()
LOCAL n
FOR n := 1 TO 10
Dlg()
NEXT
RETU NIL
STATIC FUNCTION CreateTable()
LOCAL n
LOCAL aFlds := { ;
{ "FLDID", "N", 3, 0 }, ;
{ "FLDNAME", "C", 10, 0 } ;
}
dbCreate( "XBR", aFlds )
Use XBR
for n := 1 to 50
dbAppend()
FIELD->FldID := n
FIELD->FldName := {'ONE','TWO','THREE','FOUR','FIVE'}[ HB_RandomInt( 5 ) ] + ' - ' + ltrim(str(n))
next
CLOSE DATA
return nil
oDlg:bGotFocus := { || MsgInfo( Alias() ) }
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 24 guests