TBtnBmp problem
Posted: Fri Nov 11, 2005 5:04 pm
There are problems with BtnBmp when i use them in nested forms.
try the following program:
in the nested form if i use Tbutton all works fine, but if i use
BtnBmp the program exits immediatly.
Best regards
Claudio
8<---------8<---------8<---------8<---------8<---------8<---------8<---------
#include "Fwce.ch"
#include "common.ch"
REQUEST DBFCDX
function Main()
local oWnd, oBrw
USE "Storage card\Customer" VIA "DBFCDX"
DEFINE WINDOW oWnd TITLE "test"
@ 1, 1 LISTBOX oBrw FIELDS SIZE 220, 167
a := {}
aadd(a,{"open.bmp", {|o|nested()}})
aadd(a,{"print.bmp", {|o|oWnd:End()}})
aadd(a,{"search.bmp", {|o|oWnd:End()}})
aadd(a,{"setup.bmp", {|o|oWnd:End()}})
aadd(a,{"star.bmp", {|o|oWnd:End()}})
aadd(a,{"test.bmp", {|o|oWnd:End()}})
aadd(a,{"users.bmp", {|o|oWnd:End()}})
a := aHorBtnBmp(a)
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
function nested()
local oWnd,oBrw
local a,as
a := {{"NAME", "C",10,0},;
{"TYPE", "C", 1,0} }
DbCreate( CURDIR()+"\STRUCT.DBF",a)
select customer
a := {}
for i := 1 to fCount()
aadd(a,{fieldname(i),valtype(fieldget(i))})
next i
use ( CURDIR()+"\STRUCT.DBF") alias STRU new exclusive
for i := 1 to len(a)
append blank
STRU->NAME := a[i,1]
STRU->TYPE := a[i,2]
next i
go top
DEFINE WINDOW oWnd TITLE "test"
@ 1, 1 LISTBOX oBrw FIELDS SIZE 220, 167
//#define WORKS
#ifdef WORKS
@ 12, 2 BUTTON "Done" SIZE 80, 30 ;
ACTION oWnd:End()
#else
a := {}
aadd(a,{"open.bmp", {|o|oWnd:End()}})
aadd(a,{"print.bmp", {|o|oWnd:End()}})
aadd(a,{"search.bmp", {|o|oWnd:End()}})
aadd(a,{"setup.bmp", {|o|oWnd:End()}})
aadd(a,{"star.bmp", {|o|oWnd:End()}})
aadd(a,{"test.bmp", {|o|oWnd:End()}})
aadd(a,{"users.bmp", {|o|oWnd:End()}})
a := aHorBtnBmp(a)
#endif
ACTIVATE WINDOW oWnd
close stru
return nil
// ----------------------------- aHorBtnBmp -------------------------------
//
//
function aHorBtnBmp(aBtn,nSkip,nRow,nCol,nSize,nGap,cDir)
local aObj := array(len(aBtn))
default nSkip to 0
default nRow to 234
default nCol to 2
default nSize to 32
default nGap to 2
default cDir to curdir()+"\"
nCol += nSkip*(nSize+nGap)
aeval(aObj,{|x,i|aObj := TBtnBmp():New(nRow,nCol,nSize,nSize,,,cDir+aBtn[i,1],,aBtn[i,2]), nCol += nSize+nGap})
return aObj
8<---------8<---------8<---------8<---------8<---------8<---------8<---------
try the following program:
in the nested form if i use Tbutton all works fine, but if i use
BtnBmp the program exits immediatly.
Best regards
Claudio
8<---------8<---------8<---------8<---------8<---------8<---------8<---------
#include "Fwce.ch"
#include "common.ch"
REQUEST DBFCDX
function Main()
local oWnd, oBrw
USE "Storage card\Customer" VIA "DBFCDX"
DEFINE WINDOW oWnd TITLE "test"
@ 1, 1 LISTBOX oBrw FIELDS SIZE 220, 167
a := {}
aadd(a,{"open.bmp", {|o|nested()}})
aadd(a,{"print.bmp", {|o|oWnd:End()}})
aadd(a,{"search.bmp", {|o|oWnd:End()}})
aadd(a,{"setup.bmp", {|o|oWnd:End()}})
aadd(a,{"star.bmp", {|o|oWnd:End()}})
aadd(a,{"test.bmp", {|o|oWnd:End()}})
aadd(a,{"users.bmp", {|o|oWnd:End()}})
a := aHorBtnBmp(a)
ACTIVATE WINDOW oWnd ;
ON CLICK MsgInfo( "Click!" )
return nil
function nested()
local oWnd,oBrw
local a,as
a := {{"NAME", "C",10,0},;
{"TYPE", "C", 1,0} }
DbCreate( CURDIR()+"\STRUCT.DBF",a)
select customer
a := {}
for i := 1 to fCount()
aadd(a,{fieldname(i),valtype(fieldget(i))})
next i
use ( CURDIR()+"\STRUCT.DBF") alias STRU new exclusive
for i := 1 to len(a)
append blank
STRU->NAME := a[i,1]
STRU->TYPE := a[i,2]
next i
go top
DEFINE WINDOW oWnd TITLE "test"
@ 1, 1 LISTBOX oBrw FIELDS SIZE 220, 167
//#define WORKS
#ifdef WORKS
@ 12, 2 BUTTON "Done" SIZE 80, 30 ;
ACTION oWnd:End()
#else
a := {}
aadd(a,{"open.bmp", {|o|oWnd:End()}})
aadd(a,{"print.bmp", {|o|oWnd:End()}})
aadd(a,{"search.bmp", {|o|oWnd:End()}})
aadd(a,{"setup.bmp", {|o|oWnd:End()}})
aadd(a,{"star.bmp", {|o|oWnd:End()}})
aadd(a,{"test.bmp", {|o|oWnd:End()}})
aadd(a,{"users.bmp", {|o|oWnd:End()}})
a := aHorBtnBmp(a)
#endif
ACTIVATE WINDOW oWnd
close stru
return nil
// ----------------------------- aHorBtnBmp -------------------------------
//
//
function aHorBtnBmp(aBtn,nSkip,nRow,nCol,nSize,nGap,cDir)
local aObj := array(len(aBtn))
default nSkip to 0
default nRow to 234
default nCol to 2
default nSize to 32
default nGap to 2
default cDir to curdir()+"\"
nCol += nSkip*(nSize+nGap)
aeval(aObj,{|x,i|aObj := TBtnBmp():New(nRow,nCol,nSize,nSize,,,cDir+aBtn[i,1],,aBtn[i,2]), nCol += nSize+nGap})
return aObj
8<---------8<---------8<---------8<---------8<---------8<---------8<---------