From: Grant on
I am trying to append a record in a browser by pressing a key and
automatically filling in the current date and the customer name in the
appended record. The customer name comes from a global variable. I am
trying to use the callback method RecordAppend() but I can only get it
to enter one field at a time, the date is first so that is entered but
if I comment that line out the customer name gets entered. I guess I
don't understand how this callback method works. If anyone can explain
this I would be grateful. Here is the code I am using:
METHOD RecordAppend(oEvent) CLASS dtwJob
// evaluate append mode
if oEvent:Mode=BRA_APPENDED
oEvent:Server:FIELDPUT(#JDATE,Today())
oEvent:Server:FIELDPUT(#CUSTOMER,cFName) //cFName is
global

// open edit in first column
oEvent:Control:CurrentColumn := 1
if oEvent:Control:InEdit()
oEvent:Control:EditUndo()
else
oEvent:Control:Edit()
endif
endif
return nil
From: Stephen Quinn on
Grant

> return nil
IIRC you should ALWAYS return something to bBrowser other than NIL for
callback events - read the docs.

You might try adding a
oEvent:Server:commit()
before callig edit()
- really not sure you should be caliing edit from within a callback
though.

CYA
Steve


From: Massimo Bighelli on
Grant,

in addition to Steve,
look at your indexes, if related to your appended fields

Massimo Bighelli
ARCA Sistemi S.r.l.
www.arcasistemi.it
www.arcasistemi.eu



"Grant" <grantd(a)dunsmoreinfo.com> ha scritto nel messaggio
news:a56a7cda-845e-4ec6-abf2-c6ea164817b4(a)a16g2000pre.googlegroups.com...
>I am trying to append a record in a browser by pressing a key and
> automatically filling in the current date and the customer name in the
> appended record. The customer name comes from a global variable. I am
> trying to use the callback method RecordAppend() but I can only get it
> to enter one field at a time, the date is first so that is entered but
> if I comment that line out the customer name gets entered. I guess I
> don't understand how this callback method works. If anyone can explain
> this I would be grateful. Here is the code I am using:
> METHOD RecordAppend(oEvent) CLASS dtwJob
> // evaluate append mode
> if oEvent:Mode=BRA_APPENDED
> oEvent:Server:FIELDPUT(#JDATE,Today())
> oEvent:Server:FIELDPUT(#CUSTOMER,cFName) //cFName is
> global
>
> // open edit in first column
> oEvent:Control:CurrentColumn := 1
> if oEvent:Control:InEdit()
> oEvent:Control:EditUndo()
> else
> oEvent:Control:Edit()
> endif
> endif
> return nil

From: Amilcar A. Camargo on
Hi Grant,

You will need to suspend notification events while you're appending and
updating the fields, for example:

SELF:Server:SuspendNotification()
IF SELF:Server:Append()
SELF:Server:FieldPut( ... )
SELF:Server:FieldPut( ... )
SELF:Server:Commit()
ENDIF
SELF:Server:ResetNotification()
SELF:Server:Notify( NOTIFYRECORDCHANGE )

HTH,
Amilcar A. Camargo F.
Guatemala, C. A.
From: Grant on
On Feb 19, 9:10 am, Amilcar A. Camargo <amilcarcama...(a)gmail.com>
wrote:
> Hi Grant,
>
> You will need to suspend notification events while you're appending and
> updating the fields, for example:
>
>         SELF:Server:SuspendNotification()
>         IF SELF:Server:Append()
>                 SELF:Server:FieldPut( ... )
>                 SELF:Server:FieldPut( ... )
>                 SELF:Server:Commit()
>         ENDIF
>         SELF:Server:ResetNotification()
>         SELF:Server:Notify( NOTIFYRECORDCHANGE )
>
> HTH,
> Amilcar A. Camargo F.
> Guatemala, C. A.

Thank you Amilcar. I added the SuaspendNotification and was able to
save more than one field at a time. I had used the commit() before
without success and as far as the Edit is concerned I was playing with
one of the bbrowser3 samples (EDIT) and it was just there. I have
removed it from my code now. Thank you others for your suggestions
also.



 | 
Pages: 1
Prev: 2.8 linker error
Next: bBrowser Nubie Question