• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
supplying an initial selection in WOPopUpButton and its kin
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

supplying an initial selection in WOPopUpButton and its kin


  • Subject: supplying an initial selection in WOPopUpButton and its kin
  • From: Joe Little <email@hidden>
  • Date: Tue, 20 Jul 2004 16:17:19 -0700

I've used PopUps before, where I presented a NSArray of items,
provided and initial display string, and dealt with the return value.
What I am seemingly not understanding is how to set an initial value
if one is already previous selected. My example is that I want to
assign Lab EOs to my Users. In WOPopUpButton I set this info:

displayString itemLab.labName
item itemLab
list labs
noSelectionString "Select a Lab"
selection selectedLab

In my class constructor for the overall WOComponent, I initialize both
the values:

    public edit_user(WOContext context) {
        super(context);
		labs = getLabs();
		itemLab = getSelectedLab();

However, my PopUp always displays "Select a Lab". Currently,
getSelectedLab() is:

	public Lab getSelectedLab()
	{
		selectedLab = new Lab();
		java.util.Enumeration enumerator = labs.objectEnumerator();
		while (enumerator.hasMoreElements()) {
			Object testLab = enumerator.nextElement();
            try {
					if (((Lab)testLab).id().intValue() == selectedUser.id().intValue()) {
					selectedLab = (Lab)testLab;
					}
				} catch (Exception e) {
				return selectedLab;
				}
			}
		return selectedLab;
	}

Hairy, but should do the job. Anything obviously wrong in my thinking
of how to initiate a selection?
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: supplying an initial selection in WOPopUpButton and its kin
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: Question on editing contexts
  • Next by Date: Re: Duplicate record
  • Previous by thread: Re: Question on editing contexts
  • Next by thread: Re: supplying an initial selection in WOPopUpButton and its kin
  • Index(es):
    • Date
    • Thread