From: Grant on
Hello all. I am appending a record to a browser and want the first
field of the new record to be an editable date field. It appends and
opens in edit mode but I can't save it or any other fields until I
move the cursor to a differnet record and then back. Does this make
sense? Once the cursor has moved up and down a record the new record
can be saved. It looks like I haven't been able to set the edit mode
after the append properly. The following is some of the code I am
trying to use.
The postinit sets the browser to edit mode
"self:oDCbBrowser1:Editable := true" and the new record is appended as
follows:
METHOD OnInsert() CLASS dtwJOB
//append a new record
IF self:oDCbBrowser1:Used
self:oDCbBrowser1:Append()
self:oDCbBrowser1:CurrentColumn:=1
self:oDCbBrowser1:Edit()
self:oDCbBrowser1:Recalculate()
self:oDCbBrowser1:Refresh()
ENDIF
RETURN nil
Then the date and cusomer field are entered in the callback method as
follows:
Method RecordAppend(oEvent) class dtwJob
Local dDate as date
dDate := Today()

oEvent:Server:SuspendNotification()
// evaluate append mode
if oEvent:Mode=BRA_APPENDED
// cCustomer := cFName
// initialize new record
oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
oEvent:Server:FIELDPUT(#JDATE,dDate)
oEvent:Server:Commit()
endif
oEvent:Server:ResetNotification()
oEvent:Server:Notify( NOTIFYRECORDCHANGE )
return .T.
This al works fine. Now I want the append operation to finish with the
date field open for editing and be able to enter data into the other
fields and to save the data. Now I can edit the fields but not save.
Any advice would be appreciated.
Thank you
From: Geoff Schaller on
Easy - you need a CellEdit() method in your owner window.
Look up the bBrowser help for detailed examples.

Geoff



"Grant" <grantd(a)dunsmoreinfo.com> wrote in message
news:5b967c29-a07b-41a8-a584-4dc7717a7e18(a)p3g2000pra.googlegroups.com:

> Hello all. I am appending a record to a browser and want the first
> field of the new record to be an editable date field. It appends and
> opens in edit mode but I can't save it or any other fields until I
> move the cursor to a differnet record and then back. Does this make
> sense? Once the cursor has moved up and down a record the new record
> can be saved. It looks like I haven't been able to set the edit mode
> after the append properly. The following is some of the code I am
> trying to use.
> The postinit sets the browser to edit mode
> "self:oDCbBrowser1:Editable := true" and the new record is appended as
> follows:
> METHOD OnInsert() CLASS dtwJOB
> //append a new record
> IF self:oDCbBrowser1:Used
> self:oDCbBrowser1:Append()
> self:oDCbBrowser1:CurrentColumn:=1
> self:oDCbBrowser1:Edit()
> self:oDCbBrowser1:Recalculate()
> self:oDCbBrowser1:Refresh()
> ENDIF
> RETURN nil
> Then the date and cusomer field are entered in the callback method as
> follows:
> Method RecordAppend(oEvent) class dtwJob
> Local dDate as date
> dDate := Today()
>
> oEvent:Server:SuspendNotification()
> // evaluate append mode
> if oEvent:Mode=BRA_APPENDED
> // cCustomer := cFName
> // initialize new record
> oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
> oEvent:Server:FIELDPUT(#JDATE,dDate)
> oEvent:Server:Commit()
> endif
> oEvent:Server:ResetNotification()
> oEvent:Server:Notify( NOTIFYRECORDCHANGE )
> return .T.
> This al works fine. Now I want the append operation to finish with the
> date field open for editing and be able to enter data into the other
> fields and to save the data. Now I can edit the fields but not save.
> Any advice would be appreciated.
> Thank you

From: Grant on
On Mar 10, 2:03 pm, "Geoff Schaller"
<geo...(a)softxwareobjectives.com.au> wrote:
> Easy - you need a CellEdit() method in your owner window.
> Look up the bBrowser help for detailed examples.
>
> Geoff
>
> "Grant" <gra...(a)dunsmoreinfo.com> wrote in message
>
> news:5b967c29-a07b-41a8-a584-4dc7717a7e18(a)p3g2000pra.googlegroups.com:
>
>
>
> > Hello all. I am appending a record to a browser and want the first
> > field of the new record to be an editable date field. It appends and
> > opens in edit mode but I can't save it or any other fields until I
> > move the cursor to a differnet record and then back. Does this make
> > sense? Once the cursor has moved up and down a record the new record
> > can be saved. It looks like I haven't been able to set the edit mode
> > after the append properly. The following is some of the code I am
> > trying to use.
> > The postinit sets the browser to edit mode
> > "self:oDCbBrowser1:Editable := true" and the new record is appended as
> > follows:
> >      METHOD OnInsert() CLASS dtwJOB
> >     //append a new record
> >     IF self:oDCbBrowser1:Used
> > self:oDCbBrowser1:Append()
> >    self:oDCbBrowser1:CurrentColumn:=1
> >   self:oDCbBrowser1:Edit()
> >     self:oDCbBrowser1:Recalculate()
> > self:oDCbBrowser1:Refresh()
> >     ENDIF
> >     RETURN nil
> > Then the date and cusomer field are entered in the callback method as
> > follows:
> >     Method RecordAppend(oEvent) class dtwJob
> >        Local dDate as date
> >        dDate := Today()
>
> > oEvent:Server:SuspendNotification()
> > // evaluate append mode
> > if oEvent:Mode=BRA_APPENDED
> > // cCustomer := cFName
> > // initialize new record
> > oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
> > oEvent:Server:FIELDPUT(#JDATE,dDate)
> > oEvent:Server:Commit()
> > endif
> > oEvent:Server:ResetNotification()
> > oEvent:Server:Notify( NOTIFYRECORDCHANGE )
> >     return .T.
> > This al works fine. Now I want the append operation to finish with the
> > date field open for editing and be able to enter data into the other
> > fields and to save the data. Now I can edit the fields but not save.
> > Any advice would be appreciated.
> > Thank you- Hide quoted text -
>
> - Show quoted text -

Sorry not easy to me. I studied the example but still having problems.
I have a CellEdit() method. It contains the drop down boxes for a
number of fields where the user can choose from lists to enter data. I
added a section to detect when the first cell(#JDATE)is in edit mode
and I can do things when it is detected but I not sure what to do. I
still don't see why the cell initially will allow me to edit it but
not save it unless I move the cursor to another record and back (press
the down key).
Also I'm not sure what EditMode the cell should be in to accept and
save data. The following is a section that I added to the CellEdit()
with no change.
Please advise.

METHOD CellEdit(oEvent) CLASS dtwJob
LOCAL oColumn as bDataColumn

IF oEvent:EditMode=BEDIT_CREATE
oColumn :=
oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
IF oColumn:FieldSym==#JDATE
self:oDCbBrowser1:Editable := true
ENDIF
....
From: Geoff Schaller on
Grant,

You will have a little bit of this on your own - and Joachim's sample it
pretty detailed...

But, let's try this:

CellEdit is a callback method.
The edit process is "live"
Each stage of the edit is sent to the callback method
You can then intercept and prevent or allow each action
Obviously can then also do other 'stuff' at any one of these stages.
The database is written to after BEDIT_COMMIT
The edit control is removed after BEDIT_END

But this is a "live" grid and so things must happen to refresh the rest
of the row etc. The grid can be in one of several modes - have you gone
through ALL the property settings of the bBrowser 3.0 control to see
what each of them does because certain ones behave differently.

Auto Edit has 5 different modes - it sounds like you need #Excel or
#Sensitive. Again the docs explain this.
Auto Append can replace your append code.
FieldChange Mode is critical. Try #Flexible (look up the docs for the
meaning)

Alternately, make a small sample app, paste it to the forum and we can
all work on it together.

Geoff


PS - Please top post rather than bottom post. It makes it a lot easier
to find the more recent comments.

>
> Sorry not easy to me. I studied the example but still having problems.
> I have a CellEdit() method. It contains the drop down boxes for a
> number of fields where the user can choose from lists to enter data. I
> added a section to detect when the first cell(#JDATE)is in edit mode
> and I can do things when it is detected but I not sure what to do. I
> still don't see why the cell initially will allow me to edit it but
> not save it unless I move the cursor to another record and back (press
> the down key).
> Also I'm not sure what EditMode the cell should be in to accept and
> save data. The following is a section that I added to the CellEdit()
> with no change.
> Please advise.
>
> METHOD CellEdit(oEvent) CLASS dtwJob
> LOCAL oColumn as bDataColumn
>
> IF oEvent:EditMode=BEDIT_CREATE
> oColumn :=
> oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
> IF oColumn:FieldSym==#JDATE
> self:oDCbBrowser1:Editable := true
> ENDIF
> ...

From: Mathias on
Hi Grant,

I would suggest that you do it like this instead. (see code below).
Going to edit-mode automatically does not help the user very much.
Edit mode is started on the first key stroke anyway and only makes it
more complicated if the user regrets the append.

/Mathias

 METHOD OnInsert() CLASS dtwJOB
    //append a new record
    IF self:oDCbBrowser1:Used
        self:oDCbBrowser1:Append()
        self:oDCbBrowser1:Refresh()

DoEvents()

self:oDCbBrowser1:CurrentColumn:=1
self:oDCbBrowser1:Edit() // You could skip this...
    ENDIF

    RETURN nil

On 10 mar, 19:05, Grant <gra...(a)dunsmoreinfo.com> wrote:
> Hello all. I am appending a record to a browser and want the first
> field of the new record to be an editable date field. It appends and
> opens in edit mode but I can't save it or any other fields until I
> move the cursor to a differnet record and then back. Does this make
> sense? Once the cursor has moved up and down a record the new record
> can be saved. It looks like I haven't been able to set the edit mode
> after the append properly. The following is some of the code I am
> trying to use.
> The postinit sets the browser to edit mode
> "self:oDCbBrowser1:Editable := true" and the new record is appended as
> follows:
>      METHOD OnInsert() CLASS dtwJOB
>     //append a new record
>     IF self:oDCbBrowser1:Used
>         self:oDCbBrowser1:Append()
>         self:oDCbBrowser1:CurrentColumn:=1
>         self:oDCbBrowser1:Edit()
>         self:oDCbBrowser1:Recalculate()
>         self:oDCbBrowser1:Refresh()
>     ENDIF
>     RETURN nil
> Then the date and cusomer field are entered in the callback method as
> follows:
>     Method RecordAppend(oEvent) class dtwJob
>        Local dDate as date
>        dDate := Today()
>
> oEvent:Server:SuspendNotification()
>         // evaluate append mode
>         if oEvent:Mode=BRA_APPENDED
>                 // cCustomer := cFName
>                 // initialize new record
>                 oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
>                 oEvent:Server:FIELDPUT(#JDATE,dDate)
>                 oEvent:Server:Commit()
>         endif
>         oEvent:Server:ResetNotification()
>         oEvent:Server:Notify( NOTIFYRECORDCHANGE )
>     return .T.
> This al works fine. Now I want the append operation to finish with the
> date field open for editing and be able to enter data into the other
> fields and to save the data. Now I can edit the fields but not save.
> Any advice would be appreciated.
> Thank you