Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6SP5 - Diff. ControlSource of Col and contained CBO
Message
From
05/06/2003 07:31:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00796529
Message ID:
00796567
Views:
14
This message has been marked as the solution to the initial question of the thread.
No I didn't mean to do at runtime. It's very hard to do that way. Let's walkthrough a sample :)
-Create a new form, set Datasession to Private and add orditems, products to DE (delete relation - don't need it)
-Create grid for orditems, selecting all fields in DE and drag&drop on form
-Now we have a plain grid browsing orditems
-Create a combo control on form (this is temporary but easier to play when not in grid)
-Using builder set this combo's fields to products.Prod_Name, product_id, Style dropdown list, controlsource = orditems.product_id, boundcolumn=2
-Select combo and Copy (or Cut)
-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,''))
-AFTER this set bound = .f.
-Go and change combo's controlsource back to orditems.product_id (should have changed to other iif(...
-Set current control to combo
-Increase rowheight slightly
-Run
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform