<I><FONT COLOR="#663300"><I><FONT COLOR="#663300"><I><FONT COLOR="#663300">Hello again everybody, It's the rookie, back with more questions. I was trying very hard to solve these problems myself, but if anyone can help please do.
I am working on subclassing the cifcombobox, to make it based on a view instead of a table. I am working with the example posted by Jose Constant from message 3865. I created a view (v_agreecombo) with the cid field and a character field from one of my tables. I created the agreecomboDE and v_agreecombo as cdynamicviewcursor in adataenv.prg. I created a bizobj which loads the v_agreecombo. I have over written the init(), requery() and gotfocus() using Jose's example. I have the following property values: BoundColumn = 1 (corresponding to the cid column) ColumnCount = 2 ColumnWidths = 0, 100 RowSource = v_agreecombo RowSourceType = 2 - Alias Style = 0 - Dropdown combo calias = v_agreecombo cfield = agreenum clookupalias = v_agreecombo clookupfield = v_agreecombo.agreenum (character field, 2nd column) ldisplayinitialvalue = .T.
I have the following problems: 1. The form flows right from activate to destroy, and simply flashes by, I would like it to stay around for a while, or until I want it to destroy anyway. I set breakpoints in various spots to see what was happening, and compared it to a previous form,, but I cannot tell what is different.
2. With breakpoints set, I can play with the form before it destroys. The initial value is the first agreenum in the view, so far so good. When I choose a value from the list, the cid value becomes the display value. I want the agreenum value to remain there instead.
3. I am not able to type in a value into the combo box. I was expecting to be able to type in characters, and have the list requeried with each keypress. So, if I know the first few digits of an agreenum, I could key them in, and then search the list for the specific record to choose.
Again, I know I am missing something, but I hope You can show me the way.
One thing that was really puzzling me was exactly how does one set an index to a view? I know how to order the view, but how do you set index to a view, and where?
</FONT></I>Nevermind about #1, I had overwritten the init(). I meant to put the Thisform.Requery in the activate() but mistakenly put it in the init(). One less thing.
</FONT></I>OK, nevermind about creating indexes on views. I looked at the adataenv.prg from the FCMPROD project and found the createindices function, and have used that format to create the index and tag for the view. I am learning, but any help on the other two problems is still appreciated. =)
</FONT></I>
Mike,
In order to have things running smoothly you should first build you bizobj, form, define your dataenv, etc. Once you have the form OK, add the combo after. From what I read, then combo itself seems just fine.
Taking the opportunity of this message, I must tell that I have come across certain cases where we have a "cannot access selected table" error message when the form unloads. This is because the combo is still there, but the data environment has already been destroyed.
With Claudio Campos we devised a special garbage collection scheme that destroys the combos before anything else.
José
<pre> cBaseForm: copyRight: * : *-- CHANGE - JCM - November 16, 2000 - 18:35:55 * : Added a new Method, KillClassObject, to kill an object from its class name * : Useful for killing CifCombos or CifViewCombos before the release of the dataenv. * : Called by the ReleaseDataEnvironment() method of eBizObj. .
--------------------------------------------------------------------------------
*---------------------- Location Section ---------------------- * Library...........: * Class.............: Cbaseform * Method............: *-------------------------- Copyright ------------------------- * Author............: José Constant * Project...........: SOAS * Created...........: 17/11/2000 21:50:09 * Copyright.........: (c) Constant Software Systems , 2000 * Compiler..........: Visual FoxPro 06.00.8862.00 for Windows *----------------------- Usage Section ------------------------ *) Description.......: Kills a control based on its class. * : Based on the FindControlSourceObject by Doug Hennig, modified by Bernhart Miclent and * : Claudio Daniel Campos * : Uses recursion to kill every control included in container objects * : Usefull for pesky objects like cifCombos and their siblings that produce the unfamous * : 'Cannot access selected table' error message. * Scope.............: * Parameters........: *$ Usage.............: *â0Example...........: * Returns...........: *------------------- Maintenance Section ---------------------- * .at. Inputs: D.OT ..........: * Outputs...........: * Pre-condt. invar..: * Post-condt.invar..: *? Notes.............: None * Collab.methods....: None *--Process...........: * Change log........: *-------------------------------------------------------------- LPARAMETERS tcClass, ; toObject LOCAL loContainer, ; lcField, ; laMembers[1], ; lcObject, ; loObject, ; lcClass, ; lcBaseClass * If we were passed a container, use it. Otherwise, use the form as the * container to drill down into. loContainer = IIF(pcount() = 1, THIS, toObject) lcClass = UPPER(tcClass) *-- CHANGE - JCM - November 17, 2000 - 20:24:05 *-- If the control is an ActiveX, return a .NULL. *-- Otherwise we'd get an error IF UPPER( toObject.CLASS) # "OLECONTROL" * Get a list of members in the container, then check each one. AMEMBERS(laMembers, loContainer, 2) *-- This line added by Bernhart Milcent IF TYPE("laMembers[1]") = "C" FOR EACH lcObject IN laMembers loObject = EVALUATE('loContainer.' + lcObject) lcBaseClass = UPPER(loObject.BASECLASS) DO CASE CASE UPPER(loObject.PARENTCLASS) == lcClass *-- kill it loObject.RELEASE loObject = .NULL. * For container classes, call ourselves recursively so we drill down into the * container. CASE lcBaseClass $ 'PAGE,PAGEFRAME,CONTAINER,GRID,OPTIONGROUP, COLUMN' THIS.KillClassObject(tcClass, loObject) OTHERWISE *-- nothing ENDCASE NEXT loObject ENDIF ENDIF RETURN
--------------------------------------------------------------------------------
eBizObj CopyRight: * : *-- CHANGE - CDC - Noviembre 15, 2000 - 21:51:37 * : Change in the ReleaseDataEnvironment() method to call KillClassObject for cifCombos first. * : Also set form.lockScreen to .T. if necessary
--------------------------------------------------------------------------------
ReleaseDataEnvironment *-- CHANGE - JCM - November 17, 2000 - 21:29:30 *-- Have a cleaner appearance IF thisform.LockScreen = .F. thisform.LockScreen = .T. ENDIF THISFORM.KillClassObject( 'CIFVIEWCOMBOBOX', THIS) *-- CHANGE - JCM - November 17, 2000 - 21:29:13 *-- son de la misma raza... THISFORM.KillClassObject( 'CIFCOMBOBOX', THIS) *** EGL: 3/27/98 - Changed this to a more direct test ** IF TYPE("This.oDataEnvironment") == "O" AND !ISNULL(This.oDataEnvironment) IF TYPE("This.oDataEnvironment.Name") == "C" This.oDataEnvironment.Release() ENDIF RETURN
</pre>
Jose Constant Constant Software Systems Belgium <a href=http://www.constant.be/css target=_blank>Jose's Web Site</a> ©2000 Jose Constant |
|