Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clistobjedit - Add record, add 2nd record, cancel...kabo
Message
From
24/05/2004 18:11:38
Scott Malinowski
Arizona Fox Software LLC
Arizona, United States
 
 
To
24/05/2004 14:11:05
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, California, United States
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00904742
Message ID:
00906736
Views:
20
Hello Jason,

Oh, yeah, I checked the code on the controls UMMPPteen times now. That all looks good. It appears that the kcustctl.clistobjedit.cmdadd.click code tests to see if you cancelled or actually added a record. If you add a record, it updates the grids nrecno property. However, if you cancel the add, the framework code tries to move to the record pointer for the added record that you just cancelled! This may be a bug, I'm not sure? I can't seem to locate code in the framework that resets the nrecno? I could change the framework to test to make sure the record number actually exists in the view before attempting to move the pointer, but I don't like changing framework code...no, no, no. Anywhere, here's the code in case you see something obvious that I'm missing:

*-------------------------------------------------------
*--- Edit the new record. Indicate ADD mode and pass
*--- a reference to this form and the the list object
*-------------------------------------------------------
llRetVal = DoForm(This.Parent.cEditForm, .T.,ThisForm,This.Parent.oBizObj)

*-------------------------------------------
*--- If a new record was added enable the
*--- following controls in case they were
*--- previously disabled
*-------------------------------------------
IF llRetVal
This.Parent.SetButtonEnabledStatus()
This.Parent.CListObj1.grdList.nRecNo = RECNO()
This.Parent.CListObj1.grdList.SetFocus()
ELSE
*------------------------------------
*--- Cancel the newly added record
*------------------------------------
This.Parent.oBizObj.Cancel()
IF NOT EMPTY(This.Parent.CListObj1.grdList.nRecNo) AND ;
NOT This.Parent.oBizObj.lNoRecords
lcAlias = This.Parent.oBizObj.GetAlias()
GOTO This.Parent.CListObj1.grdList.nRecNo IN (lcAlias)
ENDIF
ENDIF

As usual, thanks much for your input...I appreciate it!



>Hello Scott,
>In addition to Victor's suggestion, you might revisit the Developer's Guide and be sure you followed all the instructions for setting up your cListObjEdits. It sounds as if maybe you're missing some of the code you need to add when using these controls?
>
>Hope that helps,
>---J
>
>>Greetings!
>>
>>I have multiple clistobjedit objects on a form. On any of them if I click the Add button and add a record to the grid (which, of course, calls the edit program and saves it, etc.), it works fine. If I click the Add button again and then click the Cancel button on the edit form, I get this error:
>>
>>Error #: 5
>>Message: Record is out of range.
>>Line: 80
>>Code: GOTO This.Parent.cListObj1.grdList.nRecNo IN (lcAlias)
>>
>>Method: Click
>>Object: cashsaleform.clistobjedit2.cmdadd
>>
>>I've traced this with the debugger and guess what? It doesn't blow up in debug mode! The single record that was added to the business object is in the view and the pointer is positioned to that record already when it gets to the line of code that blows up. I don't know else to check?? All three clistobjedit objects on this form return the same message under the same circumstances.
>>
>>Any ideas?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform