Normal Topic context-sensitive drop down lists (Read 884 times)
antiques23
Member
*
Offline



Posts: 10
Joined: Apr 29th, 2009
context-sensitive drop down lists
Apr 30th, 2009 at 5:12pm
Print Post Print Post  
Okay, I don't necessarily need someone to spell out how to do this, but if you could just tell me where to look (by topic or keyword or page number or programming funciton) that would be helpful to me.

Say I want to have two drop down boxes, one for Category and one for SubCategory. Also say I want to have the SubCategory drop down options change based on the option selected in the Category drop down.

Example:

Quote:
Category
-----------
boys
girls

SubCategory (if "boys" were selected)
--------------------------------------------
adam
bobby
chris
david

SubCategory (if "girls" were selected)
-------------------------------------------
amy
brittany
cindy
diane




How would I do this? Is it dependent on setting up subforms or multiple databases that interact with each other depending on the option selected?

Thanks,
Marke
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: context-sensitive drop down lists
Reply #1 - May 1st, 2009 at 3:21am
Print Post Print Post  
This can be done two ways. If you use two comboboxes then PopulateListElement ( ) on page 319 of programming manual will help you do that. If you use want popup list with submenu or subcategory, PopUpMenu ( ) command on page 321 of programming manual has your solution. "/" creates submenu. I hope this helps.
  
Back to top
 
IP Logged
 
antiques23
Member
*
Offline



Posts: 10
Joined: Apr 29th, 2009
Re: context-sensitive drop down lists
Reply #2 - May 2nd, 2009 at 11:48am
Print Post Print Post  
Hm. Okay, thanks for the direction.

I've been experimenting with the idea using a simple test database with only two combo box elements and the concept detailed in the example on page 319 (two combo boxes, one that says Colors, Sizes, Styles and the resulting combo box filled with the pertinent options). However, I don't think I'm doing something right. When I preview the application I do end up getting a popup list in the upper right corner of the screen but the interaction is not intuitive and the first combo box usually ends up being blank. So let me ask for clarification, under which Element and Event do I put the programming detailed in the example? I've tried it under various combinations of Element: popup, Element: ComboBox1, Element: ComboBox2, Event: OnFormEntry, Event: OnElementEntry, Event: OnElementChange, etc.

Also, I'm assuming the programming example on pg 319 applies to the second combo box (since it is the one that needs to change based on the first), but does the first combo box need to have some special programming added to it to make the scenario work properly?

Thanks for you help,
Marke
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: context-sensitive drop down lists
Reply #3 - May 2nd, 2009 at 3:19pm
Print Post Print Post  
In the first combobox you will place the values namely girls;boys using Edit Choices of the combobox element. Let us say the first combobox name Category and Second combobox name is subcategory.

Following goes in Category

On exit Event or On Element Change Event

Code
Select All
var vList as String

If category = "Boys" then
   {
          vList = "adam;bobby;chris;david"
   }
  Else If Category = "Girls" then
   {
          vList = "amy;brittany;cindy;diane"
   }

PopulateListElement (SubCategory, vList) 



===========

Now when you go in SubCategory Combobox appropriate choices will be there depending on what you have selected in the Category combobox.

Quote:
When I preview the application I do end up getting a popup list in the upper right corner of the screen but the interaction is not intuitive and the first combo box usually ends up being blank.


The popup list  you mentioned are produced using  popupmenu( ), popupchoicelist and Userselct commands. This popup list can be properly displayed at proper position by using PopUpSelectPosition ( ).  It is not applicable in your case as you are using two comboboxes.
« Last Edit: May 2nd, 2009 at 7:14pm by Bharat_Naik »  
Back to top
 
IP Logged
 
antiques23
Member
*
Offline



Posts: 10
Joined: Apr 29th, 2009
Re: context-sensitive drop down lists
Reply #4 - May 2nd, 2009 at 8:29pm
Print Post Print Post  
Excellent! That helped me get it. Thanks!
Marke
  
Back to top
 
IP Logged