FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Xbrowse newbie
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Xbrowse newbie
Posted: Fri Mar 20, 2009 03:33 PM

To All

I have done considerable searches in the group and have found several ideas and code snipits for txbrowse .. however, i am having trouble piecing it all together.

Hopefully someone can give me some specific help. Here is what i am trying to do :

1) Simple .dbf with a logical ( for checkbox ) , name, date, comment char 100
2) Want to be able to have a checkbox in column 1, name .. and so on
3) Be able to click on any field in any row and have the record update as well as check on and check off for the checkbox

Nothing more complicated than that. Any examples would be helpful either from code or resource.

Regards,
Rick Lipkin
SC Dept of Health, USA

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Xbrowse newbie
Posted: Fri Mar 20, 2009 07:07 PM
Here is the answer to my own question .. for all those folks like me .. Txbrowse is very powerful .. especially using the EDIT_GET code block and notice the

oCol:SetCheck( { "ON", "OFF" } )

where "ON", "OFF" is a bitmap .. which is a resource .. that shows the checkbox column ..

Very Nice
Rick Lipkin


Code (fw): Select all Collapse
// AttBrow.prg

#include "FiveWin.Ch"
#include "XBrowse.Ch"
#include "Ord.ch"

//------------------
function _Attbrow(cMODE, oWndmdi, dDATE )

LOCAL oDlg, oBrw, oCol  //, cAlias := cGetNewAlias( "ATTEND" )
LOCAL SAYING, oBTN

cFunc := ProcName( 0 )

IF empty( dDATE)
   SAYING := "Sorry .. there was a problem passing the Class Date .. Aborting"
   MsgInfo( SAYING )
   RETURN(.F.)
ENDIF

SELECT ATTEND
SET ORDER to TAG DATE
SET SCOPE to dDATE
GO TOP

DEFINE DIALOG oDlg RESOURCE "ATTEND";
       TITLE "DPO UPDATE for DATE  "+dtoc(Ddate) //FONT WndMain():oFont

   REDEFINE XBROWSE oBrw ID 101 OF oDlg ;
      COLUMNS "Lname", "Fname", "Attend", "Remove", "Program", "District", "Phone", "Notes" ;
      ALIAS "ATTEND"    ;
      AUTOSORT FASTEDIT LINES CELL

   oBrw:bClrRowFocus    := { || { CLR_BLACK, RGB(185,220,255) } }
   oBrw:nMarqueeStyle   := MARQSTYLE_HIGHLROWMS

   if ! Empty( oCol := oBrw:oCol( "Attend" ) )
      oCol:SetCheck( { "ON", "OFF" } )
      oCol:cSortOrder  := nil
   endif

   if ! Empty( oCol := oBrw:oCol( "Remove" ) )
      oCol:SetCheck( { "ON", "OFF" } )
      oCol:cSortOrder  := nil
   endif

   AEVAL( oBrw:aCols, { |o| o:nEditType := EDIT_GET } )

   REDEFINE BUTTON oBTN1 ID 120 of oDLG ;
            ACTION( oDLG:END() )

ACTIVATE DIALOG oDlg ;
          ON INIT oBrw:SetFocus()

SELECT ATTEND
dbCommit()

RETURN(.T.)

//- end attbrow.prg

Continue the discussion