Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5 - Diff. ControlSource of Col and contained CBO
Message
De
05/06/2003 08:20:29
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00796529
Message ID:
00796594
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
:) Seek was part of sample.
Assume you created a form method like this :
*MyFinder
lparameters tnIDToFind, tcKeyField, tcFrom, tcFieldToReturn
local array arrRes[1]
select &tcFieldToreturn ;
 from (tcFrom) ;
 where &tcKeyField = tnIdToFind ;
 into array arrRes
return iif( _Tally = 0,'',arrRes )
Then your controlsource would be like :
"(thisform.myFinder(myView.ID, 'PKID', 'myLookUpView', 'Description'))"
Cetin



>Okay >Let's walkthrough a sample :)
>
>Check >-Create a new form, set Datasession to Private and add orditems, products to DE (delete relation - don't need it)
>Check >-Create grid for orditems, selecting all fields in DE and drag&drop on form
>Check >-Now we have a plain grid browsing orditems
>Check >-Create a combo control on form (this is temporary but easier to play when not in grid)
>Check >-Using builder set this combo's fields to products.Prod_Name, product_id, Style dropdown list, controlsource = orditems.product_id, boundcolumn=2
>Check >-Select combo and Copy (or Cut)
>Check >-Edit grid and select product_id column and paste
>
>>-Change Product_ID columns controlsource to (as written in PEM sheet):
>>
>>(iif(seek(orditems.product_id,'products','product_id'),products.prod_name,''))
>wait wait I have to use views, the whole thing hinges on it and okay, i'll to a index tag for trial purpose.
>Check
>
>Check >-AFTER this set bound = .f.
>Check (Hadn't changed at design time yet) >-Go and change combo's controlsource back to orditems.product_id (should have changed to other iif(...
>Check >-Set current control to combo
>Check >-Increase rowheight slightly
>Check >-Run
>
>Index was not allowed on this view. Sorry to frustrate you :(. The grid went blank, guess we'll have to start with a clean slate <g>.
>
>>Cetin
>>
>>
>>>Hiya
>>>
>>>I haven't done it your way, but if you mean that I should switch controlsouce of the col. at runtime, then maybe it was me, but I failed. I had put this.parent.controlsource = "view.cDesc" in the init of the cbo as well as lostfocus but couldn't get it to stop display if ID.
>>>
>>>>:) If this means you don't want to sparse = .f. then you might check tricky ways (not sure how good it would be - still should increase rowheight) :
>>>>
>>>>
>>>>*Column
>>>>  .Bound = .f.
>>>>  .Controlsource = "(iif(seek(mytable.id,'LookUp','pk'),"+;
>>>>       "Lookup.Desc,'')"
>>>>  .CurrentControl = 'cbo'
>>>>*Column.Text1
>>>>  .Controlsource = "(iif(seek(mytable.id,'LookUp','pk'),"+;
>>>>       "Lookup.Desc,'')"
>>>>*Column.Cbo
>>>>  .Controlsource = 'myTable.id'
>>>>  * others as should be
>>>>
Cetin
>>>>
>>>>>I'd love to see this work. Thanks Cetin keep you posted. I guess we had discussed sparse before, but I have some mental block against sparse as it modifies the grid's appearance and then you have to set cbo properties of style & others to make it look normal <g>.
>>>>>
>>>>>>
>>>>>>Change the order of columns in combo. Combo always displays the first column as DisplayValue (and incremental search works on it).
>>>>>>ie: If it's : ID, Desc and bundcolumn =1
>>>>>>Make it : Desc, ID and boundcolumn = 2
>>>>>>
>>>>>>If this is not the problem you describe, check column.sparse and set to .f.
>>>>>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform