Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check box in a browse

Status
Not open for further replies.

hag99

Technical User
Nov 8, 2003
49
0
0
US
Is there a way to get a check box in tbrowse?

Thanks for all help.

Harvey
 
It can be done. The way that I do it is to add a space at the beginning of the string in the first column. I load a dbf into an array

//--------------------------------------------------------
dbeval({|| aadd(a1, ' ' + db_names->db_name)} , ;
, ; // for
{|| db_names->db_name # 'DB_INDEX'} ; // while
, ; // next
, ; // record
.T. ; // rest
)

if(len(a1) > 12,brow := trow + 12 + 2,brow := trow + len(a1) + 2)

cChartpick := savescreen(trow,lcol,brow,rcol)
cSavecolor := setcolor('N/W')

@23,01 say padc(' F2 Mark All  ENTER Mark  F7 to Exit',maxcol() - 1,' ')

@trow,lcol,brow,rcol box B_DOUBLE + ' '

oTbr := TBrowseNew()

oTbr:nTop := tRow + 1
oTbr:nLeft := LCol + 1
oTbr:nBottom := bRow - 1
oTbr:nRight := rcol - 1

oTbc := tbcolumnnew(,{|| a1[ndx]})
oTbr:addcolumn(oTbc)
//-------------------------------------------------------

and use the ENTER key to place a check to the left of the current and selected item in the array example....
//-------------------------------------------------------
case nKey == K_ENTER
// now toggle selected marker when <enter> was pressed

a1[ndx] := iif(substr(a1[ndx],1,1) = ' ',;
chr(251) + substr(a1[ndx],3),' ' ;
+ substr(a1[ndx],3))
//---------------------------------------------------------

Then once you exit the tbrowse, you can process the array (a1) by checking to see if the first character of the array is in this case a chr(251).

Hope this helps you out.

Sam
 
Thanks for the quick response. I'll give it a try.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top