I use as always some sample programs for starting things up.
There is also 'child' windows, so that could be it also, but I never used (MDI, Child),...
In this program I try to use :
Window, Dialog, ribbonbar, folderex and Xbrowse
The problem is that I use them wrong, because the mouse is not working on the xbrowse
I can not even click on a foldertab because they do nothing
If I comment out this on line 138 :
// oDlgRB[1]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
Then the xbrowse is floating, but the mouse is working ?
Probably there is also a fault in sequence of the window, ribbon, folderex and wbrowse setup ...
Can someone help me change the program in order to get this working ?
It should compile with in the samples folder and I used customers for testing
- Code: Select all Expand view
#include "fivewin.ch"
#include "inkey.ch"
#include "ribbon.ch"
#include 'xbrowse.ch'
#include "Directry.ch"
#include 'ord.ch'
REQUEST DBFCDX
REQUEST DBFFPT
#define MY_GREEN nRGB( 145, 214, 124)
#define MY_LIGHTGREEN nRGB( 236, 255, 224)
#define MY_LIGHTYELLOW nRGB( 255, 251, 142)
#define MY_LIGHTBLUE nRGB( 214, 229, 255)
#define MY_PAARS nRGB( 232, 201, 255)
#define MY_YELLOW nRGB( 255, 220, 96)
STATIC oWnd
STATIC oDlgRB[3]
function main()
local sys_versie := "Dec 2021 - 02/12"
local cErrorLogFileName:= "MyLog.log"
local oFol,oDlg
local oRBar
local oMenu, oMenuWnd, oBrush1
local oGr, oGr1, oGr2, oGr3, oGr4
LOCAL oSay1, oBmp, oFont1
LOCAL oCursor
Public oFld
Public server_path := "\\CAROLIEN-PC\MARC\"
Public local_path := "c:\MARC\"
Public cDrive := "c:\marc\" // DEZE MOET
Public cLocal := "c:\marc\" // DEZE MOET
Public lServer:=.F.
SetPostErrorAction( { |cErrorLogFileName, oError| MyErrorAction( cErrorLogFileName, oError ) } )
RDDSetDefault( "DBFCDX" )
set( 4, "mm/dd/yyyy" )
set( 5, 1930 )
SET DATE BRITISH
set deleted on
SET EXCLUSIVE ON /// or off ?
SET AUTORDER TO 1
set exact on // juiste dingen vinden bij index exact match
setkey( VK_F12,{|| Dbftonen() } )
setkey( VK_F10,{|| popfiles() })
//SET 3DLOOK ON
xbrNumFormat( "E", .t. ) // "E" for European, "A" for American and others // .t. for showing thousand separators
menu oMenu 2007
endmenu
DEFINE FONT oFont1 NAME "Arial" SIZE 0,-30 // BOLD
DEFINE CURSOR oCursor HAND
DEFINE BRUSH oBrush1 COLOR nRGB(223,233,244) // ,nRGB(255,255,255)
DEFINE WINDOW oWnd TITLE "Maveco Bedrijfskleding " + FWVERSION from 0,0 to 1030,1920 pixel MDI MENU oMenu brush oBrush1
DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Klanten", "Leveranciers", "Ingeven Documenten";
HEIGHT 130 TOPMARGIN 25
@ 145,05 FOLDEREX SIZE 1900,700 oFld PIXEL ROUND 5 ;
PROMPT "Basis","Documenten","Personen","Facturen"
oFld:aEnable = { .t.,.T.,.T.,.T. }
oFld:aDialogs[1]:bGotfocus := { || msginfo("Hier Folder") }
ADD GROUP oGr RIBBON oRBar TO OPTION 1 PROMPT "Clipboard" width 130 BITMAP "..\bitmap\fivetech.BMP"
@ 02, 05 ADD BUTTON oBtn2 GROUP oGr BITMAP "bitmaps\cut16.BMP" ;
SIZE 75, 20 PROMPT "Dialog 01" MOSTLEFT round ;
action ( Dialog01() )
@ 24, 05 ADD BUTTON oBtn3 GROUP oGr BITMAP "bitmaps\copy16.BMP" ;
SIZE 75, 20 PROMPT "Dialog 02" MOSTLEFT round ;
action( Dialog02() )
@ 46, 05 ADD BUTTON oBtn4 GROUP oGr BITMAP "bitmaps\paste16.BMP" ;
SIZE 75, 20 PROMPT "Dialog 03" MOSTLEFT round ;
action( Dialog03() )
ADD GROUP oGr2 RIBBON oRBar TO OPTION 1 PROMPT "Exit" width 70 BITMAP "bitmap\fivetech.bmp"
@ 15, 20 ADD BUTTON oBtn4 GROUP oGr2 BITMAP "bitmaps\32x32\quit.BMP" ;
SIZE 34,52 PROMPT "Exit" action( oWnd:End())
SET MESSAGE OF oWnd TO "Version : "+sys_versie ;
CENTERED CLOCK KEYBOARD 2007
WndCenter(oWnd:hWnd)
ACTIVATE WINDOW oWnd ON INIT Dialog01() MAXIMIZED
//ACTIVATE WINDOW oWnd ON INIT oFld:dialog[1] MAXIMIZED
//ACTIVATE WINDOW oWnd MAXIMIZED
oRBar:End()
return nil
Procedure Dialog01()
LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet
LOCAL sys_klant := space(10), nWild:=1
LOCAL oFont1, oBmpAlpha
LOCAL lEscapa:=.F.
LOCAL oBrw[1], aVelden:={}, cCol
LOCAL hBmp := ReadBitmap( 0, "bitmaps\search.bmp" ) // the basic gradient bmp
// netopen("customer","last")
use customer shared NEW
HideDlg( 1 )
if ValType(oDlgRB[1]) <> "O"
DEFINE FONT oFont1 NAME "Ms Sans Serif" SIZE 0,-8 BOLD
DEFINE FONT oBold NAME 'CALIBRI' SIZE 0,-12 BOLD
DEFINE FONT oFont NAME "CALIBRI" SIZE 0,-14
DEFINE FONT oFont3 NAME "Segoe UI" SIZE 0,-12
DEFINE FONT oFontS NAME "Segoe UI" SIZE 0,-09
DEFINE FONT oFontXS NAME "Segoe UI" SIZE 0,-08
DEFINE BRUSH oBrush FILE "Bitmaps\BackGrnd\Stone.bmp"
//DEFINE DIALOG oDlgRB[1] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
DEFINE DIALOG oDlgRB[1] FROM 0,0 TO 700,1900 OF oFld:aDialogs[1] PIXEL COLORS RGB(0,0,0),RGB(255,255,255)
oDlgRB[1]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
//oDlgRB[1]:oBrush := oBrush
//oDlgRB[1]:lTransparent := .T.
aVelden := { ;
{ "ID" , "ID" ,nil, 90 }, ;
{ "First" , "First" ,nil, 350 }, ;
{ "Last" , "Last" ,nil, 300 }, ;
{ "Street" , "Street" ,nil, 300 }, ;
{ "City" , "City" ,nil, 200 }, ;
{ "Zip" , "Zip" ,nil, 150 }}
@ 0,0 XBROWSE oBrw[1] size -05,-20 PIXEL OF oDlgRB[1] font oFont ;
DATASOURCE "customer" ;
COLUMNS aVelden ;
AUTOSORT CELL LINES NOBORDER FOOTERS
oBrw[1]:SetChecks()
oBrw[1]:nStretchCol := STRETCHCOL_WIDEST
oBrw[1]:lHScroll := .F.
oBrw[1]:nHeadStrAligns := AL_CENTER
for each cCol in { "First","Last","Street"}
WITH OBJECT oBrw[1]:oCol( cCol )
:nEditType := EDIT_GET
:bClrHeader := { || { CLR_GREEN, 155 } }
END
next
// Search GETBAR
oBrw[1]:lGetBar := .T.
for each cCol in { "First","Last","Street","City","Zip"}
WITH OBJECT oBrw[1]:oCol( cCol )
:uBarGetVal := uValBlank( :Value )
:cBarGetPic := :cEditPicture
:bClrEdit := { || { CLR_BLACK, MY_LIGHTYELLOW }}
:lBarGetOnKey := .t. // after having setfocus the oBrowse object, the end user can insert the characters directly into the get
:cBarGetBmp := hBmp // this for show the Bitmap on the get
:bBarGetAction := { || ( oBrw[1]:cAlias )->( SetFilter( oBrw[1] )) } // this for show the bitmap on the get and associated a action
//:bBarGetChange := { |k,f,o| msginfo("Enter") }
END
next
WITH OBJECT oBrw[1]
:lColChangeNotify := .t.
:lFooter := .t.
:bRecSelHeader := { || "Klant" }
:bRecSelData := { |o| o:KeyNo }
:bRecSelFooter := { |o| o:nLen }
:oRecSelFont := oFont3 // optional
:nRecSelWidth := "99999" // required size
:lHScroll := .f.
:lMultiSelect := .T.
:bLDClickDatas := { || msginfo("Enter") }
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bClrSelFocus = {|| { CLR_WHITE, RGB(0, 128, 128) } } // CUANDO TIENE EL FOCUS
:oHeaderFonts := oBold
:bKeyDown := { |k| if (K == VK_DELETE, Del_row(oBrw[1]),nil ) }
END
oBrw[1]:CreateFromCode()
oBrw[1]:setfocus()
ACTIVATE DIALOG oDlgRB[1] NOWAIT ; //CENTERED
ON INIT (oDlgRB[1]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
VALID lEscapa
else
oDlgRB[1]:Show()
endif
Return
Procedure Dialog02()
LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 02"
LOCAL oFont1, oBmpAlpha
LOCAL lEscapa:=.F.
HideDlg( 2 )
if ValType(oDlgRB[2]) <> "O"
oBmpAlpha:=TImage():Define(, "..\Bitmaps\AlphaBmp\World.bmp" )
DEFINE FONT oFont1 NAME "Ms Sans Serif" SIZE 0,-8 BOLD
DEFINE BRUSH oBrush FILE "..\Bitmaps\BackGrnd\Stone.bmp"
DEFINE DIALOG oDlgRB[2] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
oDlgRB[2]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
oDlgRB[2]:oBrush := oBrush
oDlgRB[2]:lTransparent := .T.
@ 30,30 SAY "Some text bla bla bla in DIALOG 02" OF oDlgRB[2] PIXEL COLOR nRGB(0,0,125) FONT oFont1
@ 45,30 GET oGet VAR cTxtGet OF oDlgRB[2] PIXEL
ACTIVATE DIALOG oDlgRB[2] NOWAIT ; //CENTERED
ON INIT (oDlgRB[2]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
ON PAINT (ABPaint( hDC,365,230, oBmpAlpha:hBitmap, 255 ));
VALID lEscapa
else
oDlgRB[2]:Show()
endif
Return
Procedure Dialog03()
LOCAL aCoords:=GetCoors(oWnd:oWndClient), oBrush, oGet, cTxtGet:="Get in Dialog 03"
LOCAL oFont1, oBmpAlpha
LOCAL lEscapa:=.F.
HideDlg( 3 )
if ValType(oDlgRB[3]) <> "O"
oBmpAlpha:=TImage():Define(, "..\Bitmaps\AlphaBmp\World.bmp" )
DEFINE FONT oFont1 NAME "Ms Sans Serif" SIZE 0,-8 BOLD
DEFINE BRUSH oBrush FILE "..\Bitmaps\BackGrnd\Stone.bmp"
DEFINE DIALOG oDlgRB[3] FROM 0,0 TO 538,782 OF oWnd:oWndClient PIXEL // COLORS RGB(0,0,0),RGB(255,255,255)
oDlgRB[3]:nStyle := nOR(WS_CHILD) // ,WS_THICKFRAME
oDlgRB[3]:oBrush := oBrush
oDlgRB[3]:lTransparent := .T.
@ 40,40 SAY "Some text bla bla bla in DIALOG 03" OF oDlgRB[3] PIXEL COLOR nRGB(0,0,125) FONT oFont1
@ 45,40 GET oGet VAR cTxtGet OF oDlgRB[3] PIXEL
ACTIVATE DIALOG oDlgRB[3] NOWAIT ; //CENTERED
ON INIT (oDlgRB[3]:Move(aCoords[1]+0,aCoords[2]+0,,,.T.));
ON PAINT (ABPaint( hDC,395,260, oBmpAlpha:hBitmap, 255 ));
VALID lEscapa
else
oDlgRB[3]:Show()
endif
Return
Procedure HideDlg( nDlg )
LOCAL i:=1
for i:=1 TO Len(oDlgRB)
if ValType(oDlgRB[i])=="O"
oDlgRB[i]:Hide()
endif
next
Return
function MyErrorAction( cErrorLogFileName, oError )
LOCAL cErrScreen:=""
msginfo("Er is een fout opgetreden in het programma. Gelieve het programma opnieuw te starten")
return NIL
function lookup_klant(cKlant)
msginfo(cKlant)
return NIL
Function dbftonen()
local cErrorlog:=""
cErrorLog += CRLF + "DataBases in use" + CRLF + "================" + CRLF
for n = 1 to 255
if ! Empty( Alias( n ) )
cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n,"=> ", " " ) + ;
(Alias(n))->( DbInfo( DBI_FULLPATH ) ) + Space( 2 ) + "RddName: " + ;
( Alias( n ) )->( RddName() ) + CRLF
cErrorLog += " =======================================================" + CRLF
cErrorLog += " RecNo RecCount BOF EOF" + CRLF
cErrorLog += " " + Transform( ( Alias( n ) )->( RecNo() ), "9999999" ) + ;
" " + Transform( ( Alias( n ) )->( RecCount() ), "9999999" ) + ;
" " + cValToChar( ( Alias( n ) )->( BoF() ) ) + ;
" " + cValToChar( ( Alias( n ) )->( EoF() ) ) + Transform( ( Alias( n ) )->( ordkeycount() ), "9999999" ) + CRLF + CRLF
if ( Alias( n ) )->( RddName() ) != "ARRAYRDD"
cErrorLog += " Indexes in use " + Space( 23 ) + "TagName" + CRLF + CRLF
for j = 1 to 25
if ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
cErrorLog += Space( 8 ) + ;
If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", " " ) + ;
PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
( Alias( n ) )->( OrdName( j ) ) + ;
CRLF
endif
next
cErrorLog += CRLF + " Relations in use" + CRLF + CRLF
for j = 1 to 8
if ! Empty( ( nTarget := ( Alias( n ) )->( DbRSelect( j ) ) ) )
cErrorLog += Space( 3 ) + Str( j ) + ": " + ;
"TO " + ( Alias( n ) )->( DbRelation( j ) ) + ;
" INTO " + Alias( nTarget ) + CRLF
// uValue = ( Alias( n ) )->( DbRelation( j ) )
// cErrorLog += cValToChar( ordsetfocus( uValue ) ) + CRLF
endif
next
endif
endif
next
//msginfo(cErrorlog)
// MemoEdit( @cText, [ctitle], [nTop], [nLeft], [nBottom], [nRight], [lRTF] ) --> lEdited.
MemoEdit( @cErrorlog,"Geopende Databases",10,60,60,150)
return NIL
function Popfiles()
SET 3DLOOK ON
DEFINE BRUSH oBrush STYLE TILED // FiveWin new predefined Brushes
DEFINE FONT oBold NAME 'CALIBRI' SIZE 0,-12 BOLD
DEFINE FONT oFont NAME "CALIBRI" SIZE 0,-14
DEFINE FONT oFontBig NAME "CALIBRI" SIZE 0,-24
DEFINE DIALOG oDlgpop SIZE 200,100 PIXEL TRUEPIXEL ;
TITLE "Klantenbestand : ";
GRADIENT { { 1, nRGB( 125, 155, 175 ), nRGB( 125, 155, 175 ) } }
DEFINE BUTTONBAR oBar OF oDlgpop SIZE 45,45 2007
DEFINE BUTTON oBtnSave OF oBar FILE "bitmaps\save.bmp" PROMPT "Data" GROUP TOOLTIP "Gegevens" ;
ACTION popopenfile()
DEFINE BUTTON OF oBar FILE "bitmaps\print.bmp" PROMPT "Struct" TOOLTIP "Structure" ;
ACTION popopenstruc()
ACTIVATE DIALOG oDlgpop
return
function popopenfile()
local oBrw
if ! Empty( cFile := cGetFile( "DataFile (*.DBF)|*.dbf|", ;
"Select Data File to Browse",1, ;
"\programmas\fotoselect" ) )
use &cFile alias datastruc NEW
aStruc := DBSTRUCT()
xbrowser("datastruc") SHOW RECID FASTEDIT AUTOSORT ;
SETUP (oBrw:lIncrFilter := .t.,oBrw:lSeekWild := .t. )
close datastruc
endif
return NIL
function popopenstruc()
local cFile
LOCAL aStruc
if ! Empty( cFile := cGetFile( "DataFile (*.DBF)|*.dbf|", ;
"Select Data File to Browse",1, ;
"\programmas\fotoselect" ) )
//use &cFile alias STRUC NEW shared
use &cFile alias DATASTRUC NEW shared
aStruc := datastruc->(DBSTRUCT())
xbrowser(aStruc)
close datastruc
endif
return NIL
FUNCTION NETOPEN( cFile, cIndex, lMode, cAlias, nSeconds, lNewArea,cDriver, lReadOnly )
local nWaitTime, lContinue := .t., lSuccess := .f., TSEL := 0
DEFAULT lMode := .T. // shared mode
DEFAULT cIndex :=""
DEFAULT nSeconds := 3
DEFAULT cAlias := cFile
DEFAULT lNewArea := .t.
//DEFAULT cDriver := "COMIX"
DEFAULT cDriver := "DBFCDX"
//DEFAULT cDriver := "DBFNTX"
DEFAULT lReadOnly := .f.
nWaitTime := nSeconds
//cFile = cDrive+cFile
cFile = alltrim(cFile)+".dbf"
if lServer
cFile = server_path + cFile
else
cFile = local_path + cFile
endif
// Hier mag/moet eerst controle op //server// en dan eventueel de vraag stellen indien geen server aanwezig
// Netopen ( cFile, lServer, cIndex,...)
// bestand het bestand
IF ! FILE( cFile )
Exit("Bestand " + CFILE + ".DBF is afwezig")
ENDIF
// verify driver is valid
if ascan( RddList(), cDriver ) == 0
MSGSTOP("Driver " + Cdriver + " afwezig")
Exit()
endif
//
// Indien reeds geopend, alles ok, select waar
//
IF SELECT(cAlias) # 0
MsgInfo("File : "+cAlias+" is reeds geopend")
TSEL := SELECT(cAlias)
SELECT(TSEL)
lContinue := .t.
lNewArea := .f.
ENDIF
// while continuing to attempt open
Do while lContinue // while .not. timed-out
while nSeconds > 0 .and. lContinue
//dbUseArea( lNewArea, cDriver, cFile, cAlias, ( .not. lMode ), lReadOnly )
dbUseArea( lNewArea, cDriver, cFile, cAlias, lMode, lReadOnly )
// check for success/failure
IF neterr()
nSeconds--
lSuccess := .F.
else
// open successful
nSeconds := 0
lSuccess := .t.
lContinue := .f.
ENDIF
ENDDO
IF ! lSuccess
nSeconds := nWaitTime
MSGSTOP("Bestand " + CFILE+" Alias : "+cAlias + " is geopend door een andere gebruiker" + CRLF + CRLF + "Gelieve even te wachten")
lSuccess := .F.
lContinue := .T.
lNewArea := .T.
ENDIF
if !empty(cIndex)
&cAlias->(dbsetorder(cIndex))
endif
ENDDO
return lSuccess
CLASS TSeek STATIC
DATA oBrw
METHOD New( oBrw ) CONSTRUCTOR
METHOD SetText( c ) INLINE ::oBrw:RefreshFooters()
ENDCLASS
METHOD New( oBrw ) CLASS TSeek
::oBrw := oBrw
return Self
function del_row(oBrw)
if MsgYesNo("Deze regel wissen")
oBrw:delete()
endif
return
Function Exit(cErrInfo)
cErrInfo+= CRLF + "Gelieve deze fout te melden"+ CRLF + CRLF + "Het Programma zal nu eindigen"
close all
MSGSTOP(cErrInfo)
SET RESOURCES TO
ErrorLevel( 1 )
QUIT
return NIL
static function SetFilter( oBrw )
local cFilter := ""
local n, oCol, uVal, cType
for n := 1 to Len( oBrw:aCols )
oCol := oBrw:aCols[ n ]
if ! Empty( uVal := oCol:uBarGetVal )
if !Empty( cFilter )
cFilter += " .AND. "
endif
cType := ValType( uVal )
do case
case cType == 'C'
uVal := Upper( AllTrim( uVal ) )
// cFilter += '"' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
cFilter += '"' + uVal + '" $ UPPER( ' + oCol:CExpr + " )"
otherwise
// cFilter += FieldName( n ) + " == " + cValToChar( uVal )
cFilter += oCol:cExpr + " == " + cValToChar( uVal )
endcase
endif
next
*******************************
*/
//msginfo(cFilter)
//msgGet( "title", "message", @cFilter )
if Empty( cFilter )
if ! Empty( DBFILTER() )
DBCLEARFILTER()
oBrw:Refresh()
endif
else
if !( DBFILTER() == cFilter )
SET FILTER TO &cFilter
GO TOP
oBrw:Refresh()
endif
endif
oBrw:SetFocus()
return nil