Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keep Drop Down List Boxes in Sync
Message
From
03/01/2001 07:08:57
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00458752
Message ID:
00458837
Views:
24
Hi Vlad

THis is the code that activates the page.
* iKey holds the parameter of the of the p-view JobView
ThisForm.iKey = INT(VAL(SUBSTR(Node.Key, 5)))
REQUERY("JobView")
SELECT "JobView"
ThisForm.PageFrame1.ActivePage = 4
ThisForm.PageFrame1.Page4.Refresh()
In the .Activate of the page the following code populates the comboboxes
WITH This  && Form.PageFrame1.Page4
  * Customer Listbox
  SELECT ;
    Customer.CustName, Customer.CustId;
    FROM ShopTrack!Customer;
    ORDER BY Customer.CustName;
    INTO ARRAY .cboCustomer.laData
  IF _TALLY = 0
    DIMENSION .cboCustomer.laData[1,1]
    STORE "No Customers" TO .cboCustomer.laData
  ENDIF
  * Contact Listbox
  SELECT ;
    ALLTRIM(Contacts.LName) + ', ' + ALLTRIM(Contacts.FName) AS ContName,;
    Contacts.ContId;
    FROM ShopTrack!Contacts;
    WHERE Contacts.CustId = INT(VAL(.cboCustomer.List(.cboCustomer.ListIndex, 2)));
    ORDER BY ContName;
    INTO ARRAY .cboContact.laData
  IF _TALLY = 0
    DIMENSION .cboContact.laData[1,1]
    STORE "No Contacts" TO .cboContact.laData
  ENDIF
ENDWITH
Valid empty on both
InteractiveChange  Customer cbo
WITH This.Parent
  lnCustId = INT(VAL(This.List(This.ListIndex, 2)))
  DIMENSION .cboContact.laData[1,1]
  SELECT ;
    ALLTRIM(Contacts.LName) + ', ' + ALLTRIM(Contacts.FName) AS ContName,;
    Contacts.ContId;
    FROM ShopTrack!Contacts;
    WHERE Contacts.CustId = lnCustId;
    ORDER BY ContName;
    INTO ARRAY .cboContact.laData
  IF _TALLY = 0
    STORE "No Contacts" TO .cboContact.laData
  ENDIF
  .cboContact.Requery()
  .cboContact.ListIndex = 1
ENDWITH

BountColumn 2 on both
BoundTo .t. on both
ControlSource jobview.custid and jobview.contid
RowSourceType array
RowSource (or code that fills it) see above
Thanks so much for your help

>Hi!
>
>Hmm, it seems you expect that record pointer in the view changed when you select record in the first (company) combobox. Than, if second combobox tied to view using control source, you just need to call refresh method of the second combobox after record pointer changed. Better do this in the Valid event of the first combobox - for comboboxes Valid seems called each time value changed.
>
>It will be also much better if you tell exactly following properties and methods of both comboboxes:
>
>Valid
>InteractiveChange
>BountColumn
>BoundTo
>ControlSource
>RowSourceType
>RowSource (or code that fills it)
>
>etc.
>
>This way problem could be figured out exactly.
>
>>I have two dropdown list boxes on a pageframe that is bound to a view. The first box contains two columns company name and company id, it's bound to the id. The second box contains contact name and contact id for the current company, it's bound to the contact id of the view. The contact drop down list box does not stay in sync when I select another company from the treeview. When I select the second item for the same company the contact catches up. I am populating the list boxes in the activate of the page. The p-view contains company id and contact id and part info. I must be missing something ...
>>
>>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform