txbrowse from code

Post Reply
Ehab Samir Aziz
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

txbrowse from code

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Ehab Samir Aziz
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Post by Ehab Samir Aziz »

How can I fill the dialog with the columns of txbrowse ?
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Try oDlg:oClient := oBrw

James
Ehab Samir Aziz
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Post 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 



Ehab Samir Aziz
Posts: 334
Joined: Fri Oct 14, 2005 1:54 pm

Post 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 
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 = ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply