I wish Use the sample samples\barchange.prg, developed by Cristobal Navarro
but the buttonbar must be insert down a xbrowse
so I use Newat() method
barchange.prg with Newat() Method of oBar
- Code: Select all Expand view RUN
// developed by Cristobal Navarro
#include 'fivewin.ch'
#include 'xbrowse.ch'
#include "constant.ch"
Function test()
local oDlg,oDbf,oFont
local oBar
local nBottom := 27.2
local nRight := 89
local nWd := Max( nRight * DLG_CHARPIX_W, 180 )
local nHt := nBottom * DLG_CHARPIX_H
aData := {}
for n := 1 to 10
AAdd( aData, { n, "Item-" + StrZero( n, 2 ), ;
HB_RandomInt( 1, 999 ), HB_RandomInt( 1, 9999 ), ;
Space( 5 ), ;
HB_RandomInt( 1, 9999 ) } )
next
DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL;
TiTle "test"
oDlg:lHelpIcon := .F.
@ 30,10 XBROWSE oBrw SIZE -10,-220 PIXEL OF oDlg ;
DATASOURCE aData ;
AUTOCOLS HEADERS { "SlNo", "Item" } ;
COLSIZES 40 ;
CELL LINES FOOTERS NOBORDER FASTEDIT
oBrw:CreateFromCode()
@ 250, 10 Button "Second bar" size 100,18 PIXEL OF oDlg action Btnbar(2,oDlg:oBar,oDlg,oBrw)
@ 250, 200 Button "First bar" size 100,18 PIXEL OF oDlg action Btnbar(1,oDlg:oBar,oDlg,oBrw)
ACTIVATE DIALOG oDlg CENTER ;
ON INIT ( Btnbar(0,oBar,oDlg,oBrw), Btnbar(1,oDlg:oBar,oDlg,oBrw) )
RETURN NIL
//----------------------------------------------------------------------------//
Function Btnbar(nBar,oBar,oDlg,oBrw) // ,aBtnBar
local aBtnBar
local x
if Valtype( oBar ) = "O"
For x := Len( oBar:aControls ) to 1 step - 1
oBar:Del( x )
Next x
endif
Do case
case nbar = 0
* DEFINE BUTTONBAR oBar OF oDlg SIZE 80,70 TOP NOBORDER 2015
oBar:= TBar():NewAt( oBrw:nbottom+1, oBrw:nLeft, oBrw:nWidth-120, 25, 80, 25, oDlg, .f.,;
, , .t., .f., .f., .t., .f., ;
, , , , , .t. )
oBar:bClrGrad := { | lPressed | If( ! lPressed,;
{ { 1, RGB( 250,250,245), RGB( 250,250,245)} },;
{ { 1, RGB( 245,245,235), RGB( 245,245,235)} } ) }
case nbar = 1
aBtnBar := array(6)
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "New" action msginfo()
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Modify" action msginfo()
DEFINE BUTTON aBtnBar[3] OF oBar PROMPT "Duplicate" action msginfo()
DEFINE BUTTON aBtnBar[4] OF oBar PROMPT "Del" action msginfo()
DEFINE BUTTON aBtnBar[5] OF oBar PROMPT "Print" action msginfo()
DEFINE BUTTON aBtnBar[6] OF oBar PROMPT "Help" action msginfo("Help")
case nbar = 2
aBtnBar := array(2)
DEFINE BUTTON aBtnBar[1] OF oBar PROMPT "Del" action msginfo("Del")
DEFINE BUTTON aBtnBar[2] OF oBar PROMPT "Print" action msginfo("Print")
endcase
return oBar
//----------------------------------------------------------------------------/
Error
- Code: Select all Expand view RUN
Time from start: 0 hours 0 mins 0 secs
Error occurred at: 12/06/23, 21:48:52
Error description: Error BASE/1004 No exported method: ISKINDOF
Args:
[ 1] = U
[ 2] = C TBAR
Stack Calls
===========
Called from: => ISKINDOF( 0 )
Called from: C:\Work\fwh\source\classes\btnbmp.prg => TBTNBMP:NEWBAR( 491 )
Called from: barchange.prg => BTNBAR( 76 )
Called from: barchange.prg => (b)TEST( 45 )