I am trying to get a dbcombo functional in this xbrowse sample by Mr. Nages
The oRec:drvr displays fine ,but without any functional dbcombo.
Don't know if I've chosen the proper form of dbcombo or have the syntax correct.
Any help appreciated.
Bruce
Code: Select all
Local oTruc, oBrw, oDlg, oRec
// path_seg defined static above
oTruc := TDataBase():New()
oTruc := TDataBase():Open( , cPath_seg + 'TRUC' )
DEFINE DIALOG oDlg FROM 10, 25 TO 35, 100 TITLE " Tdatabase Test"
@ 12,10 XBROWSE oBrw SIZE -10,-30 PIXEL OF oDlg ;
FIELDS oTruc:TAG , oTruc:Que_dte, oTruc:Shp_dte, oTruc:org , oTruc:DrpA ,;
oTruc:DrpB , oTruc:DrpC , oTruc:Drvr , oTruc:Qty1 , oTruc:Desc1,;
oTruc:Qty2 , oTruc:Desc2 , oTruc:Trip_num,oTruc:Notes ;
HEADERS "Tag","Que Date","Ship Date", "Orgin", "A", "B", "C", "DR",;
"Qty1","Desc1","Qty2","Desc2", "Trip #", "Notes" ;
FIELDSIZES 30 , 60 , 60 , 45, 45, 45, 45, 40,;
30, 50, 30, 50, 45, 160 ;
OBJECT oTruc ;
AUTOSORT ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:bEdit := { |oRec| CustEditDlg( oRec ) } // reconfigures edit()
:CreateFromCode() // seems to need this to make xbrowse display
END
@ 170,10 BUTTON "Add" SIZE 40,12 PIXEL OF oDlg ;
ACTION ( oRec := TDataRow():New( oTruc, nil, .t. ), oRec:Edit(), oBrw:Refresh(), oBrw:SetFocus() )
@ 170,60 BUTTON "Edit" SIZE 40,12 PIXEL OF oDlg ;
ACTION ( oRec := TDataRow():New( oTruc ), oRec:Edit(), oBrw:Refresh(), oBrw:SetFocus() )
ACTIVATE DIALOG oDlg
oTruc:close()
return nil
//---------------------------------------//
// downloaded 02/09/15 FW
// 09/08/13 cust edit dialog nages - Xbrow, add, edit, modify, delete
static function CustEditDlg( oRec )
local oDlg, oFont, oGrp
local oDrv, oDbc2
oDrv := TDataBase():New()
oDrv := TDataBase():Open( , cPath_seg + 'T_drv' )
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 618,382 PIXEL FONT oFont TITLE "EDIT MILL"
@ 0, 4 GROUP oGrp TO 168, 305 OF oDlg PIXEL
@ 12, 10 SAY "Tag:" OF oDlg SIZE 15, 8 PIXEL
@ 10, 44 GET oRec:Tag OF oDlg SIZE 105, 12 PIXEL UPDATE
@ 26, 10 SAY "Que Dte:" OF oDlg SIZE 15, 8 PIXEL
@ 24, 44 GET oRec:Que_dte OF oDlg SIZE 105, 12 PIXEL UPDATE
@ 40, 10 SAY "Shp_dte:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 44 GET oRec:shp_dte OF oDlg SIZE 155, 12 PIXEL UPDATE
@ 54, 10 SAY "Org:" OF oDlg SIZE 13, 8 PIXEL
@ 52, 44 GET oRec:org OF oDlg SIZE 155, 12 PIXEL UPDATE
@ 68, 10 SAY "Drp A:" OF oDlg SIZE 19, 8 PIXEL
@ 66, 44 GET oRec:DrpA OF oDlg SIZE 15, 12 PIXEL UPDATE
@ 82, 10 SAY "Drp B:" OF oDlg SIZE 12, 8 PIXEL
@ 80, 44 GET oRec:DrpB OF oDlg SIZE 55, 12 PIXEL UPDATE
@ 96, 10 SAY "Drp C:" OF oDlg SIZE 29, 8 PIXEL
@ 94, 44 GET oRec:DrpC OF oDlg SIZE 44, 12 PIXEL UPDATE
@ 124, 10 SAY "Drvr:" OF oDlg SIZE 15, 8 PIXEL
//@ 122, 44 GET oRec:Drvr OF oDlg SIZE 12, 12 PIXEL UPDATE PICTURE "99"
@ 146, 40 dbcombo oDBC2 var oRec:Drvr of oDlg;
alias oDrv:cAlias;
size 75,250 pixel;
itemfield "DRVR" ;
listfield "TNAME";
update
@ 138, 10 SAY "Qty 1:" OF oDlg SIZE 21, 8 PIXEL
@ 136, 44 GET oRec:Qty1 OF oDlg SIZE 40, 12 PIXEL UPDATE PICTURE "999999.99"
@ 152, 10 SAY "Desc 1:" OF oDlg SIZE 21, 8 PIXEL
@ 150, 44 GET oRec:Desc1 OF oDlg SIZE 255, 12 PIXEL UPDATE
@ 172, 175 BUTTON "&Undo" OF oDlg SIZE 42, 14 PIXEL WHEN oRec:Modified() ACTION ( oRec:UnDo(), oDlg:Update() )
@ 172, 219 BUTTON "&Save" OF oDlg SIZE 42, 14 PIXEL WHEN oRec:Modified() ACTION ( oRec:Save(), oDlg:Update() )
@ 172, 263 BUTTON "&Close" OF oDlg SIZE 42, 14 PIXEL CANCEL ACTION ;
( If( oRec:Modified() .and. MsgYesNo( "Save Changes ?" ), oRec:Save(), nil ), oDlg:End() )
AEval( oDlg:aControls, { |o| If( o:ClassName == "TGET", o:bValid := { || oDlg:AEvalWhen(), .t. }, nil ) } )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
oDrv:close()
return nil