Page 1 of 1
txbrowse from code
Posted: Sat Nov 11, 2006 1:49 pm
by Ehab Samir Aziz
I am trying to build a dialog of txbrowse and I don't know what is missing ?
Code: Select all
STATIC FUNCTION NewDialog( oWnd )
local oDlg, oBrw, oCol
oBrw := TXBrowse():New( oWnd )
DEFINE DIALOG oDlg FROM 0,0 TO 45,128 TITLE "Customer browse "
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg
RETURN NIL
Posted: Sat Nov 11, 2006 3:17 pm
by Antonio Linares
Code: Select all
STATIC FUNCTION NewDialog( oWnd )
local oDlg, oBrw, oCol
DEFINE DIALOG oDlg FROM 0,0 TO 45,128 TITLE "Customer browse "
ACTIVATE DIALOG oDlg ;
ON INIT oBrw := BuildBrowse( oDlg )
RETURN NIL
function BuildBrowse( oWnd )
local oBrw := TXBrowse():New( oWnd )
oBrw:CreateFromCode()
return oBrw
Posted: Sat Nov 11, 2006 7:20 pm
by Ehab Samir Aziz
How can I fill the dialog with the columns of txbrowse ?
Posted: Sat Nov 11, 2006 7:35 pm
by James Bott
Try oDlg:oClient := oBrw
James
Posted: Sat Nov 11, 2006 8:01 pm
by Ehab Samir Aziz
No Not work I tried it before . I think the code should be like this . I mean BuildBrowse does not know nothing about oWnd.
Code: Select all
STATIC FUNCTION NewDialog( oWnd )
local oDlg, oBrw, oCol
DEFINE DIALOG oDlg FROM 0,0 TO 45,128 TITLE "Customer browse "
ACTIVATE DIALOG oDlg ;
ON INIT oBrw := BuildBrowse( oDlg )
RETURN NIL
function BuildBrowse( oDlg )
local oBrw := TXBrowse():New( oDlg )
oBrw:CreateFromCode()
oDlg:oClient:=oBrw
return oBrw
Posted: Wed Nov 15, 2006 6:23 am
by Ehab Samir Aziz
Adding buttons in such way overlaps the columns of xbrowse .
Code: Select all
STATIC FUNCTION NewDialog( oWnd )
local oDlg, oBrw, oCol
DEFINE DIALOG oDlg FROM 0,0 TO 45,128 TITLE "Customer browse "
ACTIVATE DIALOG oDlg ;
ON INIT oBrw := BuildBrowse( oDlg )
RETURN NIL
function BuildBrowse( oDlg )
local oBrw := TXBrowse():New( oDlg )
oBrw:CreateFromCode()
oDlg:oClient:=oBrw
oDlg:ReSize()
@ 17, 1 BUTTON "&New" OF oDlg SIZE 40, 12 //ACTION Editcust( oLbx, .t. )
@ 17, 8 BUTTON "&Modify" OF oDlg SIZE 40, 12 //ACTION Editcust( oLbx, .f. )
@ 17, 15 BUTTON "&Delete" OF oDlg SIZE 40, 12 //ACTION Delrecord( oLbx )
@ 17, 22 BUTTON "&Search" OF oDlg SIZE 40, 12 //ACTION SeekCust( oLbx )
@ 17, 29 BUTTON "&Print" OF oDlg
//ACTION oLbx:Report( "Customers Report", .t. ) ; // .t. --> wants preview
//SIZE 40, 12
@ 17, 36 BUTTON "&Exit" OF oDlg //ACTION oDlg:End() SIZE 40, 12
@ 18, 1 BUTTON "&Order" OF oDlg //ACTION ordercust(oLbx) SIZE 40, 12
@ 18, 8 BUTTON "&Filter" OF oDlg //ACTION filtercust(oLbx) SIZE 40, 12
@ 18, 15 BUTTON "&Unfilter" OF oDlg //ACTION Nonfiltercust(oLbx) SIZE 40, 12
return oBrw
Posted: Wed Nov 15, 2006 8:45 am
by Antonio Linares
Ehab,
Thats because you are using oDlg:oClient:=oBrw and that means to use the entire dialog area.
You may change oDlg:oClient:=oBrw into:
oBrw:nTop = ...
oBrw:nLeft = ...
oBrw:nWidth = ...
oBrw:nHeight = ...