Test new features

Test new features

Postby Daniel Garcia-Gil » Mon Dec 29, 2008 3:39 pm

test TXBROWSE new features

* New: Class TXBrowse DATA nBtnBmp to select the bitmap index from the array oCol:aBitmaps so the button image can be changed, when these edit styles are used: EDIT_LISTBOX, EDIT_BUTTON, EDIT_GET_LISTBOX and EDIT_GET_BUTTON.

* New: Class TXBrowse Method ChangeBitmap(), selects the button image using DATA nBtnBmp value.

http://rapidshare.com/files/177841907/xbbtget.rar

//-----------------------------------------------------------------------------//

* New: Class TXBrowse DATA lAutoAppend used when FastEdit is active and allows to automatically append a new record to the xbrowse when EOF is true. It is on by default.

http://rapidshare.com/files/177845240/xbrwappe.rar

//-----------------------------------------------------------------------------//

* New: Class TXBrowse DATA oEditFont allows to set a desired font for editing. A font object or a codeblock may be used.

http://rapidshare.com/files/177846582/xbEFont.rar

//-----------------------------------------------------------------------------//

* New: Class TXBrowse DATA bToolTip allows to set a tooltip to the xbrowse cells.

http://rapidshare.com/files/177851157/xbCellTT.rar

//-----------------------------------------------------------------------------//

* New: Class TXBrowse DATA cBmpAdjBrush, adjusts the brush to the entire area of the browse. To avoid the "TILED" style, it has to be used with SetBackGround().

http://rapidshare.com/files/177843295/xbrwbru.rar

//-----------------------------------------------------------------------------//
//-----------------------------------------------------------------------------//

test TGET new feature

* New: Class TGet DATAs nClrTextDis, nClrPaneDis to allow the change of the colors of the get when it is disabled. Codeblocks are allowed too.

http://rapidshare.com/files/177854316/DisGet.rar
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Postby Antonio Linares » Mon Dec 29, 2008 3:49 pm

Daniel,

Muchas gracias! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 29, 2008 4:20 pm

Copiamos aqui el codigo fuente de estos ejemplos:

xbBtGet.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

// xbrowse imagen button get

function main()

local oDlg, oBrw
local aArray := {}
local aList := {"1","2","3","4"}
local nI

for nI = 1 to 20
aadd( aArray, { "Row:"+StrZero(nI,2)+" Col:01",;
                        "Row:"+StrZero(nI,2)+" Col:02",;
                        "Row:"+StrZero(nI,2)+" Col:03",;
                        "Row:"+StrZero(nI,2)+" Col:04",;
                        "Row:"+StrZero(nI,2)+" Col:05",;
                        "Row:"+StrZero(nI,2)+" Col:06" } )
next

DEFINE DIALOG oDlg Title "Test ButtonGet xBrowse " size 700,300

oBrw:= txbrowse():new( oDlg )
oBrw:nRowHeight := 25
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:nRowDividerStyle := LINESTYLE_BLACK
oBrw:SetArray( aArray )
oBrw:CreateFromCode()

oBrw:aCols[ 2 ]:AddBmpFile("closeall.bmp")         // charge bitmap into oCol:aBitmaps
oBrw:aCols[ 2 ]:AddBmpFile("open2.bmp")            // can use AddResource and AddBmpHandle
oBrw:aCols[ 2 ]:AddBmpFile("paste.bmp")
oBrw:aCols[ 2 ]:AddBmpFile("browse.bmp")
oBrw:aCols[ 2 ]:nEditType( EDIT_GET_BUTTON )
oBrw:aCols[ 2 ]:nBtnBmp := 1                                                            // Position bitmaps into oCol:aBitmaps
oBrw:aCols[ 2 ]:bEditBlock := {|| msginfo( oBrw:aRow[ 2 ] ) }

oBrw:aCols[ 3 ]:nEditType( EDIT_GET_LISTBOX )
oBrw:aCols[ 3 ]:aEditListTxt := aList
oBrw:aCols[ 3 ]:AddBmpFile("find.bmp")
oBrw:aCols[ 3 ]:nBtnBmp := 1
oBrw:aCols[ 3 ]:bOnPostEdit := {|o,x,k| oBrw:aCols[ 2 ]:nBtnBmp := x , ;
oBrw:aCols[ 2 ]:ChangeBitMap() }

ACTIVATE DIALOG oDlg center;
ON INIT ( oDlg:oClient := oBrw, ;
oDlg:ReSize() )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 29, 2008 4:21 pm

xBCellTT.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"



procedure main()

local oBrw, oWnd
local i

    setballoon( .t. )
   USE test
   

   DEFINE WINDOW oWnd title "CELL TOOLTIP"
   
 
   @ 0, 0 XBROWSE oBrw OF oWnd ALIAS "test" autocols lines fastedit

    oBrw:nRowHeight := 25
   
   // 1 column
   oBrw:aCols[ 1 ]:bToolTip := {|oBrw, nRow, nCol, nKeyFlas| if ( oBrw:MouseRowPos( nRow ) == oBrw:nRowSel,;
                                                                     if ( test->Married, "Married", "Single" ),) }
 
  // 2 column
   oBrw:aCols[ 2 ]:bToolTip := {|oBrw, nRow, nCol, nKeyFlas| if ( oBrw:MouseRowPos( nRow ) == oBrw:nRowSel,;
                                                                     dtoc( test->hiredate ), ) }
 
  // specific data column 3 only record 6
   oBrw:aCols[ 3 ]:bToolTip := {|oBrw, nRow, nCol, nKeyFlas| if ( oBrw:MouseRowPos( nRow ) == oBrw:nRowSel,;
                                                                     if( test->( recno() ) == 6,"Record: 6" , ), ) }
 
 
   oBrw:CreateFromCode()
   
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

return
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 29, 2008 4:21 pm

xbEFont.prg

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"



procedure main()

local oBrw, oWnd, oFont, oFont2
local i

     
   define font oFont name "currier new" bold italic size 0,-14
   define font oFont2 name "terminal" bold size 0,-16
   


   USE test
   

   DEFINE WINDOW oWnd title "Change Edit font xbrowse"
   
 
   @ 0, 0 XBROWSE oBrw OF oWnd ALIAS "test" autocols lines fastedit

    oBrw:nRowHeight := 25
   for i = 1 to len( oBrw:aCols )
       oBrw:aCols[ i ]:nEditType := EDIT_GET
       oBrw:aCols[ i ]:oEditFont := {|| if ( test->married, oFont, oFont2 ) }
    next
 

 
   oBrw:CreateFromCode()
   
   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

return
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 29, 2008 4:22 pm

xbautap.prg

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

static oWnd
function MainTest()

   local oMenu
     
    set delete on

   menu oMenu
      menuitem "Dbfs..." action dbfs()
      menuitem "Arrays..." action Arra()
      menuitem "Salir" action oWnd:end()
   endmenu
   

   DEFINE WINDOW oWnd menu oMenu mdi
   
   ACTIVATE WINDOW oWnd

return nil   
   
procedure dbfs()   
local oBrw, oWndChild, oBar, oCol
local nLast
local lAuto := .t.
     
    set delete on

   USE test
   

   DEFINE WINDOW oWndChild of oWnd mdichild
   
   define buttonbar oBar of oWndChild
   
   define button of oBar prompt "ON" action( oBrw:lAutoappend := lAuto:= .t. ) top when !lAuto
   define button of oBar prompt "OFF" action( oBrw:lAutoappend := lAuto:= .f.) top   when lAuto
   define button of obar prompt "Exit" action( oWndChild:end()   )          top
   
   
   @ 0, 0 XBROWSE oBrw OF oWndChild ALIAS "test"


   oBrw:nMarqueeStyle = 3
   oBrw:nColDividerStyle =  LINESTYLE_BLACK
   oBrw:nRowDividerStyle = LINESTYLE_BLACK
   oBrw:lHScroll  =  .T.
   oBrw:lColDividerComplete    =  .T.
   oBrw:lAutoAppend =  lAuto
   oBrw:lFastEdit  =  .T.
        oBrw:bPastEof = {|| Dbappend(), oBrw:refresh(), oBrw:aCols[ 1 ]:Edit() }
  oBrw:bKeyDown = {|nKey| if( nKey == VK_DELETE ,;
                            ( nLast:=recno(),test->( dbdelete() ), __Dbpack(), dbgoto(nLast) ),), oBrw:refresh() }
   
   oCol = oBrw:AddCol()
   oCol:bStrData    = { || test->First }
   oCol:cHeader     = "First"
   oCol:nEditType   = EDIT_GET
   oCol:bOnPostEdit = ;
            { | oCol, xVal, nKey | if( xVal == space( 20 ) .and. nKey == VK_ESCAPE,;
                                                 ( nLast:=recno(),test->( dbdelete() ), __Dbpack(),dbgoto(nLast-1) ),;// Afirmacion
                                                ( If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), ;//Negativa
                                                  If( nKey == VK_RETURN, test->First := xVal,) )), oBrw:refresh() }
    oCol:bEditValid   =   {|o| if ( o:value() == space(20), .f., .t.) }
   
   oCol = oBrw:AddCol()
   oCol:bStrData    = { || test->Last }
   oCol:cHeader     = "Last"
   oCol:nEditType   = EDIT_GET
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( RecCount() == 0, DbAppend(),), If( nKey == VK_RETURN, ( test->Last := xVal, oBrw:Refresh() ),) }
   
   oBrw:CreateFromCode()
   
   oWndChild:oClient := oBrw

   ACTIVATE WINDOW oWndChild

return

procedure arra()
local oWndChild, oBar, oB
local aBrw := {}
local lAuto := .f.

      use test
   
      test->( DbGoTop()   )
      do while !test->( eof() )
         aadd( aBrw, { test->first, test->last } )
         test->( dbskip() )
      enddo
      

      define WINDOW oWndChild of oWnd mdichild

   define buttonbar oBar of oWndChild
   
   define button of oBar prompt "ON" action( oB:lAutoappend := lAuto:= .t. ) top when !lAuto
   define button of oBar prompt "OFF" action( oB:lAutoappend := lAuto:= .f.) top   when lAuto
   define button of obar prompt "Exit" action( oWndChild:end()   )          top
      
   
      @ 8,0 xBROWSE oB of oWndChild ;
      columns 1,2 ;
      headers "First", "Last" ;
      picture "@!","@!";
      sizes  150,150 array aBrw fastedit
   
      oB:nMarqueeStyle                         :=       MARQSTYLE_HIGHLCELL
      oB:nRowDividerStyle                   :=       1
      oB:nColDividerStyle                   :=       1
      oB:nRowHeight                            :=       25
      oB:lAutoAppend                           :=       lAuto
      
      oB:bPastEof                                 :=    ;
         {|| if( oB:aRow[ 1 ] != space( 20 )  ,;
                     ( aadd( oB:aArrayData, {space( 20 ), space( 20 )} ),;
                     oB:GoDown() ,;
                     oB:Refresh(),;
                     oB:GoLeftMost(),;
                     oB:aCols[ 1 ]:Edit() ),) }
               
      oB:bKeyDown := {| nKey | if( nKey == VK_DELETE .and. oB:aRow[ 1 ] <> space( 20 ),;
                                                            if ( msgyesno("Desea eliminar el renglón") ,;
                                                                  ( aDel( oB:aArraydata, oB:nArrayAt ),;
                                                                    ASize( oB:aArraydata, len( oB:aArrayData ) -1 ),;
                                                                     oB:nArrayAt := MIN(oB:nArrayAt,LEN(oB:aArraydata)),;
                                                                     oB:EraseData( oB:nArrayAt ) ),),),;
                                                             if ( len( oB:aArraydata ) == 0, ;
                                                                   aadd( oB:aArraydata, {space( 20 ), space( 20 ) } ),),;
                                                             oB:refresh() }

      oB:aCols[ 1 ]:nEditType   :=       EDIT_GET
      oB:aCols[ 1 ]:bEditvalid   :=       { | oGet | if ( oGet:Value() == space( 20 ), .f., .t. ) }
      oB:aCols[ 1 ]:bOnPostEdit:=       ;
            {|oBj, x, nKey| if ( x == space( 20 ) .and. len( oB:aArrayData ) > 1, ;
                              (if ( len( oB:aArrayData) = oB:nArrayAt .and. oB:aRow[ 1 ] == space( 20 ),;
                                  (ADel( oB:aArraydata, oB:nArrayAt ),;
                                     ASize( oB:aArraydata, len( oB:aArrayData ) -1 ),;
                                             oB:nArrayAt := MIN(oB:nArrayAt,LEN(oB:aArraydata) ),;
                                             oB:EraseData( oB:nArrayAt ),;
                                             oB:refresh() ),) ), oB:aRow[ 1 ] := x ) }
      
      
   
      oB:aCols[ 2 ]:nEditType   :=       EDIT_GET
      oB:aCols[ 2 ]:bOnPostEdit := {| oBj, x, nKey | if ( nKey == VK_RETURN, oB:aRow[ 2 ] := x,) }

      oB:CreateFromCode()   
      
   oWndChild:oClient := oB
         

      Activate WINDOW oWndChild
   
return
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Dec 29, 2008 4:23 pm

xBrwBru.prg

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

function main()

local oDlg, oFolder
local aBrw      := array( 4 )
local aArray1 := {}
local nI



for nI = 1 to 20
aadd( aArray1, { "Row:"+StrZero(nI,2)+" Col:01",;
                        "Row:"+StrZero(nI,2)+" Col:02",;
                        "Row:"+StrZero(nI,2)+" Col:03",;
                        "Row:"+StrZero(nI,2)+" Col:04",;
                        "Row:"+StrZero(nI,2)+" Col:05",;
                        "Row:"+StrZero(nI,2)+" Col:06" } )
next


//define
DEFINE dialog oDlg Title "Test Brush Auto Adjust" size 700,300
@ 1,1 folder oFolder of oDlg prompt "Test1","Test2","Test3" size 340,130


aBrw[ 1 ]:= txbrowse():new( oFolder:aDialogs[ 1 ] )
aBrw[ 1 ]:nRowHeight := 25
aBrw[ 1 ]:nColDividerStyle    := LINESTYLE_BLACK
aBrw[ 1 ]:nRowDividerStyle    := LINESTYLE_BLACK
aBrw[ 1 ]:SetArray( aArray1 )
aBrw[ 1 ]:cBmpAdjBrush          := "frog.bmp"
aBrw[ 1 ]:SetBackGround( "frog.bmp" )
aBrw[ 1 ]:CreateFromCode()
aBrw[ 1 ]:bClrStd                := {|| {CLR_WHITE, CLR_BLACK} }
aBrw[ 1 ]:nTop                      := 0
aBrw[ 1 ]:nLeft                     := 0
aBrw[ 1 ]:nBottom                  := 120
aBrw[ 1 ]:nRight                  := 160

aBrw[ 2 ]:= txbrowse():new( oFolder:aDialogs[ 1 ] )
aBrw[ 2 ]:nRowHeight := 25
aBrw[ 2 ]:nColDividerStyle    := LINESTYLE_BLACK
aBrw[ 2 ]:nRowDividerStyle    := LINESTYLE_BLACK
aBrw[ 2 ]:SetArray( aArray1 )
aBrw[ 2 ]:cBmpAdjBrush          := "cara.bmp"
aBrw[ 2 ]:SetBackGround( "cara.bmp" )
aBrw[ 2 ]:CreateFromCode()
aBrw[ 2 ]:bClrStd                := {|| {CLR_WHITE, CLR_BLACK} }
aBrw[ 2 ]:nTop                      := 0
aBrw[ 2 ]:nLeft                     := 170
aBrw[ 2 ]:nBottom                  := 120
aBrw[ 2 ]:nRight                  := 330

aBrw[ 3 ]:= txbrowse():new( oFolder:aDialogs[ 2 ] )
aBrw[ 3 ]:nRowHeight := 25
aBrw[ 3 ]:nColDividerStyle    := LINESTYLE_BLACK
aBrw[ 3 ]:nRowDividerStyle    := LINESTYLE_BLACK
aBrw[ 3 ]:SetArray( aArray1 )
aBrw[ 3 ]:cBmpAdjBrush          := "back.bmp"
aBrw[ 3 ]:SetBackGround( "back.bmp" )
aBrw[ 3 ]:CreateFromCode()
aBrw[ 3 ]:bClrStd                := {|| {CLR_WHITE, CLR_BLACK} }
aBrw[ 3 ]:nTop                      := 0
aBrw[ 3 ]:nLeft                     := 0
aBrw[ 3 ]:nBottom                  := 120
aBrw[ 3 ]:nRight                  := 330

aBrw[ 4 ]:= txbrowse():new( oFolder:aDialogs[ 3 ] )
aBrw[ 4 ]:nRowHeight := 25
aBrw[ 4 ]:nColDividerStyle    := LINESTYLE_BLACK
aBrw[ 4 ]:nRowDividerStyle    := LINESTYLE_BLACK
aBrw[ 4 ]:SetArray( aArray1 )
aBrw[ 4 ]:cBmpAdjBrush          := "agua2.bmp"
aBrw[ 4 ]:SetBackGround( "agua2.bmp" )
aBrw[ 4 ]:CreateFromCode()
aBrw[ 4 ]:bClrStd                := {|| {CLR_WHITE, CLR_BLACK} }
aBrw[ 4 ]:nTop                      := 0
aBrw[ 4 ]:nLeft                     := 0
aBrw[ 4 ]:nBottom                  := 120
aBrw[ 4 ]:nRight                  := 330



//oDlg:oClient := oBrw

ACTIVATE dialog oDlg

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41462
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 147 guests