Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo boxes
Message
From
03/07/2001 08:54:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/07/2001 16:28:46
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00525878
Message ID:
00526224
Views:
21
>hi cetin
>oops, i tried that too but no success. btw how do i default the 2nd combobox to column2, pls? ta

Sn,
I think you mean boundcolumn. Boundcolumn=2. If you mean displayvalue then place what would be displayed as first column and adjust columnwidths.
*Combo1.init
With this
  .RowSourceType = 3
  .RowSource = 'select cust_id, company from customer into cursor crs1'
  .Columnwidths='100,100'
  .Columncount=2
  .BoundColumn=1
Endwith

*Combo2.init
With this
  .RowSourceType = 3
  .RowSource = 'select company,cust_id from customer into cursor crs2'
  .Columnwidths='100,100'
  .Columncount=2
  .BoundColumn=2
Endwith

*Combo1.Interactivechange
=seek(this.value,'customer','cust_id')
thisform.combo2.listindex = this.listindex && For Combo2 change combo2 to combo1
thisform.refresh

*Form.init
select customer
30 && Go 30
store customer.cust_id to ;
  ThisForm.Combo1.Value,;
  ThisForm.Combo2.Value && Adjust combos
With rowsourcetype set to something using cursor\table (like Fields,alias,SQL) bear in mind that record pointer moves as selection changes. IOW this is fairly legal (and which I prefer instead of depending on boundcolumn, value, list, listindex etc - and more flexible than using long obj refs):
*thisform.myPageFrame.myPage.mycontainer.Mycombo.init
With this
  .RowSourceType = 3
  .RowSource = 'select * from customer into cursor crs1'
  .Columncount=2 && Showfirst 2 cols only
  .Columnwidths='100,100'
Endwith

*Any method
* Rec pointer already moved with selection
* crs1 has all fields from customer
lcCust_id = crs1.cust_id 
lcCountry = crs1.country
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
Reply
Map
View

Click here to load this message in the networking platform