bBrowser Edit problem

  • Follow


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
0
Reply grantd (4) 3/10/2010 6:05:51 PM

Easy - you need a CellEdit() method in your owner window.
Look up the bBrowser help for detailed examples.

Geoff



"Grant" <grantd@dunsmoreinfo.com> wrote in message 
news:5b967c29-a07b-41a8-a584-4dc7717a7e18@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

0
Reply Geoff 3/10/2010 10:03:10 PM


On Mar 10, 2:03=A0pm, "Geoff Schaller"
<geo...@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...@dunsmoreinfo.com> wrote in message
>
> news:5b967c29-a07b-41a8-a584-4dc7717a7e18@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 :=3D true" and the new record is appended a=
s
> > follows:
> > =A0 =A0 =A0METHOD OnInsert() CLASS dtwJOB
> > =A0 =A0 //append a new record
> > =A0 =A0 IF self:oDCbBrowser1:Used
> > self:oDCbBrowser1:Append()
> > =A0 =A0self:oDCbBrowser1:CurrentColumn:=3D1
> > =A0 self:oDCbBrowser1:Edit()
> > =A0 =A0 self:oDCbBrowser1:Recalculate()
> > self:oDCbBrowser1:Refresh()
> > =A0 =A0 ENDIF
> > =A0 =A0 RETURN nil
> > Then the date and cusomer field are entered in the callback method as
> > follows:
> > =A0 =A0 Method RecordAppend(oEvent) class dtwJob
> > =A0 =A0 =A0 =A0Local dDate as date
> > =A0 =A0 =A0 =A0dDate :=3D Today()
>
> > oEvent:Server:SuspendNotification()
> > // evaluate append mode
> > if oEvent:Mode=3DBRA_APPENDED
> > // cCustomer :=3D 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 )
> > =A0 =A0 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=3DBEDIT_CREATE
		oColumn :=3D
oEvent:Control:GetOpenColumn(oEvent:EditCell:Column)
		IF oColumn:FieldSym=3D=3D#JDATE
		   self:oDCbBrowser1:Editable :=3D true
		ENDIF
....
0
Reply Grant 3/11/2010 5:52:07 AM

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

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

         DoEvents()

         self:oDCbBrowser1:CurrentColumn:=3D1
         self:oDCbBrowser1:Edit() // You could skip this...
 =A0 =A0 ENDIF

 =A0 =A0 RETURN nil

On 10 mar, 19:05, Grant <gra...@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 :=3D true" and the new record is appended as
> follows:
> =A0 =A0 =A0METHOD OnInsert() CLASS dtwJOB
> =A0 =A0 //append a new record
> =A0 =A0 IF self:oDCbBrowser1:Used
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Append()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:CurrentColumn:=3D1
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Edit()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Recalculate()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Refresh()
> =A0 =A0 ENDIF
> =A0 =A0 RETURN nil
> Then the date and cusomer field are entered in the callback method as
> follows:
> =A0 =A0 Method RecordAppend(oEvent) class dtwJob
> =A0 =A0 =A0 =A0Local dDate as date
> =A0 =A0 =A0 =A0dDate :=3D Today()
>
> oEvent:Server:SuspendNotification()
> =A0 =A0 =A0 =A0 // evaluate append mode
> =A0 =A0 =A0 =A0 if oEvent:Mode=3DBRA_APPENDED
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // cCustomer :=3D cFName
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // initialize new record
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:FIELDPUT(#JDATE,dDate)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:Commit()
> =A0 =A0 =A0 =A0 endif
> =A0 =A0 =A0 =A0 oEvent:Server:ResetNotification()
> =A0 =A0 =A0 =A0 oEvent:Server:Notify( NOTIFYRECORDCHANGE )
> =A0 =A0 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

0
Reply Mathias 3/12/2010 8:39:21 AM

Thank you for your comments Geoff and Mathias. I am now top posting. I
apologize for not responding sooner but I am doing as you said Geoff
and have created a sample app which is working fine as far as I have
gotten. I will post again if I run into trouble but now I'm learning a
lot and appreciate your help.


On Mar 10, 11:05=A0am, Grant <gra...@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 :=3D true" and the new record is appended as
> follows:
> =A0 =A0 =A0METHOD OnInsert() CLASS dtwJOB
> =A0 =A0 //append a new record
> =A0 =A0 IF self:oDCbBrowser1:Used
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Append()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:CurrentColumn:=3D1
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Edit()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Recalculate()
> =A0 =A0 =A0 =A0 self:oDCbBrowser1:Refresh()
> =A0 =A0 ENDIF
> =A0 =A0 RETURN nil
> Then the date and cusomer field are entered in the callback method as
> follows:
> =A0 =A0 Method RecordAppend(oEvent) class dtwJob
> =A0 =A0 =A0 =A0Local dDate as date
> =A0 =A0 =A0 =A0dDate :=3D Today()
>
> oEvent:Server:SuspendNotification()
> =A0 =A0 =A0 =A0 // evaluate append mode
> =A0 =A0 =A0 =A0 if oEvent:Mode=3DBRA_APPENDED
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // cCustomer :=3D cFName
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // initialize new record
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:FIELDPUT(#CUSTOMER, cFName)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:FIELDPUT(#JDATE,dDate)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 oEvent:Server:Commit()
> =A0 =A0 =A0 =A0 endif
> =A0 =A0 =A0 =A0 oEvent:Server:ResetNotification()
> =A0 =A0 =A0 =A0 oEvent:Server:Notify( NOTIFYRECORDCHANGE )
> =A0 =A0 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

0
Reply Grant 3/16/2010 6:07:14 PM

4 Replies
221 Views

(page loaded in 0.112 seconds)

Similiar Articles:













7/22/2012 6:32:13 AM


Reply: