Dear All,
I am using May-2006 build. I face two problem while using a Numeric Item Field.
1) I have to initialise the variable with Record Position + 1, instead of actual value. This is not the case with Character value.
2) In above case, variable is initialised with above Record Position. If Dbcombo, do not get the focus, its value remains record position only.
3) While issuing oDbc:Refill(), I get error on DbCombo.PRG => TDBCOMBO:RILL(167). It seems typo, Rill instead of Fill.
Can anybody shed light on it ?
Below is the sample code.
TIA
Milan.
---------------------------Cut-------------------------------------
# include "fivewin.ch"
# include "DBCOMBO.CH"
function Main()
local oDlg, oCbx, obtn, nItemCode
local cName := ' '
Cret_Test()
DEFINE DIALOG oDlg FROM 10, 10 TO 20, 50 ;
TITLE "DBomboBox Test"
nItemCode := 3
SELECT Test
Locate for Itemcode==nItemCode
IF found()
nItemCode := RecNo() + 1
ELSE
nItemCode := 0
endif
@ 0.5, 1 GET cName PICTURE "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@ 1.5, 1 DBCOMBO oCbx VAR nItemCode ALIAS "TEST" ITEMFIELD "ITEMCODE" LISTFIELD "ITEMNAME"
@ 2, 1 SAY nItemCode PICT '999'
@ 3, 1 BUTTON obtn ACTION New_Rec(oCbx)
ACTIVATE DIALOG oDlg CENTERED
MsgInfo (nItemCode)
RETURN NIL
PROCEDURE Cret_Test
LOCAL aTest := {;
{ "ITEMCODE" , "N", 5, 0 },;
{ "ITEMNAME" , "C", 30, 0 } }
DBCREATE ('TEST', aTest)
SELE 0
USE TEST
FOR I = 1 TO 10
APPE BLANK
REPLACE ITEMCODE WITH 11-I
REPLACE ITEMNAME WITH 'ITEM-'+STR(11-I,5)
NEXT
RETURN
PROCEDURE add_rec()
LOCAL nRec
SELECT Test
appe blank
nRec := LASTREC() + 1
REPLACE ITEMCODE WITH nRec
REPLACE ITEMNAME WITH 'ITEM-' + LTRIM (Str(nRec,5))
COMMIT
RETURN
PROCEDURE New_Rec(oCbx)
add_rec()
oCbx:Refill()
oCbx:ReSet()
oCbx:DEFAULT()
return
---------------------------Paste----------------------------------