Page 1 of 1

Dialogs with Txbrowse

Posted: Fri Apr 21, 2006 9:36 am
by Ehab Samir Aziz
The dimesions of dialog with txbrowse do not fit with the buttons.

Code: Select all

//------------------------------------------------------------------
STATIC FUNCTION mete( oWnd )
*--------------------------
   local oChild, oBrw
   Local oDlgn, oDbfc, oBrwc

   local nRecNo  := RecNo()
   local new_rec  := 0
   local oGet
   local i:=0
   local oCombo1:= Space( 10 )
   local oCombo2:= Space( 8 )
   local oCombo3:= Space( 6 )
   local oCombo4:= Space( 20 )
   local oCombo5:= Space( 8 )
   local V_MC_serial:= Space( 7 )

   local nFor
   local bFilter := ""
   local cFilter := ""
   local x := ""

REQUEST ADS 
rddRegister( "ADS", 1 ) 
rddsetdefault( "ADS" ) 
AdsSetDeleted(.T.) 
SET SERVER LOCAL 
SET FILETYPE TO CDX 




*x := "'9855564'" 
*cFilter := "me_mc_serl = "+ x 
*bFilter = "{||"+cFilter+"}"


SELECT 4
use mete index mete2
GO TOP


DEFINE DIALOG oDlgn  FROM 1,1 TO 30,120 TITLE "Dialog Meter Works" 



   oBrw := TXBrowse():New( oDlgn )

   *oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()



   for nFor := 1 to Fcount()
   if nFor=20
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(),12,0))
      loop
   endif
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := FieldName( nFor )
   next





   @ 9,   1 BUTTON "&New"    OF oDlgn SIZE 40, 12 //ACTION Editmach( oLbx, .t. )
   @ 9,  8 BUTTON "&Modify" OF oDlgn SIZE 40, 12  //ACTION Editmach( oLbx, .f. ) 
   @ 9, 15 BUTTON "&Delete" OF oDlgn  SIZE 40, 12  //ACTION Delrecord( oLbx )
   @ 9, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach( oLbx ) 
   @ 9, 29 BUTTON "&Print"  OF oDlgn ;
      SIZE 40, 12;
      ACTION oBrw:Report( "Machines Report", .t. ) ;  // .t. --> wants preview


   @ 9, 36 BUTTON "&Exit"   OF oDlgn ACTION oDlgn:End() SIZE 40, 12

   @ 10,  1 BUTTON "&Order"    OF oDlgn SIZE 40, 12 //ACTION ordermach(oLbx) 
   @ 10,  8 BUTTON "&Filter"    OF oDlgn SIZE 40, 12 //ACTION metefilter(oLbx) 
   @ 10,  15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk(oLbx) 

   oBrw:CreateFromCode()

   oDlgn:oClient := oBrw



   ACTIVATE DIALOG oDlgn 

RETURN NIL
[img]
[/img]

Posted: Fri Apr 21, 2006 10:39 am
by Antonio Linares
Ehab,

You can not do this:

oDlgn:oClient := oBrw

because then you are giving all the client area to the browse. Use oBrw:SetSize( nWidth, nHeight )

Posted: Fri Apr 21, 2006 10:54 pm
by Ehab Samir Aziz
http://img60.imageshack.us/img60/8303/txbrowse1ee.jpg

I did not find any effect of that sentence to the code !!!

Code: Select all

STATIC FUNCTION mete( oWnd )
*--------------------------
   local oChild, oBrw
   Local oDlgn, oDbfc, oBrwc

   local nRecNo  := RecNo()
   local new_rec  := 0
   local oGet
   local i:=0
   local oCombo1:= Space( 10 )
   local oCombo2:= Space( 8 )
   local oCombo3:= Space( 6 )
   local oCombo4:= Space( 20 )
   local oCombo5:= Space( 8 )
   local V_MC_serial:= Space( 7 )

   local nFor
   local bFilter := ""
   local cFilter := ""
   local x := ""

REQUEST ADS 
rddRegister( "ADS", 1 ) 
rddsetdefault( "ADS" ) 
AdsSetDeleted(.T.) 
SET SERVER LOCAL 
SET FILETYPE TO CDX 

SELECT 4
use mete index mete2
GO TOP


DEFINE DIALOG oDlgn  FROM 1,1 TO 30,120 TITLE "Dialog Meter Works" 



   oBrw := TXBrowse():New( oDlgn )

   oBrw:nMarqueeStyle       := MARQSTYLE_HIGHLCELL
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:lColDividerComplete := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nFooterLines        := 1
   oBrw:nDataLines          := 1
   oBrw:lFooter             := .t.
   oBrw:SetRDD()


   for nFor := 1 to Fcount()
   if nFor=20
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := alltrim(STR(TOTALEM2(),12,0))
      loop
   endif
      oBrw:aCols[ nFor ]:cHeader       := FieldName( nFor )
      oBrw:aCols[ nFor ]:cFooter       := FieldName( nFor )
   next


   @ 9, 1 BUTTON "&New"    OF oDlgn SIZE 40, 12 //ACTION Editmach( oLbx, .t. )
   @ 9, 8 BUTTON "&Modify" OF oDlgn SIZE 40, 12  //ACTION Editmach( oLbx, .f. ) 
   @ 9, 15 BUTTON "&Delete" OF oDlgn  SIZE 40, 12  //ACTION Delrecord( oLbx )
   @ 9, 22 BUTTON "&Search" OF oDlgn SIZE 40, 12 //ACTION Seekmach( oLbx ) 
   @ 9, 29 BUTTON "&Print"  OF oDlgn ;
      SIZE 40, 12;
      ACTION oBrw:Report( "Machines Report", .t. ) ;  // .t. --> wants preview


   @ 9, 36 BUTTON "&Exit"   OF oDlgn ACTION oDlgn:End() SIZE 40, 12

   @ 10,  1 BUTTON "&Order"    OF oDlgn SIZE 40, 12 //ACTION ordermach(oLbx) 
   @ 10,  8 BUTTON "&Filter"    OF oDlgn SIZE 40, 12 //ACTION metefilter(oLbx) 
   @ 10,  15 BUTTON "&Unfilter" OF oDlgn SIZE 40, 12 //ACTION filtermachNotOk(oLbx) 



   oBrw:SetSize( 20, 20 )
   oBrw:CreateFromCode()


   *oDlgn:oClient := oBrw



   ACTIVATE DIALOG oDlgn 

RETURN NIL