On 19-Mar-08, at 5:18 PM, Yury Peskin wrote:

Hello List,
I need to have the WOPopUp Button set to a specific value.
I have a project EO that has a to-one relationship to project status EO and I need a WOPopUp button to display a specific project status.
Here’s what my WOPopUp Button is wired like:
list = projectStatusList (a list of all project statuses)
item = project.projectStatus (the specific value a WOPopUp Button should have)
displayString = projectStatus.message (a display message)
selection = selectedProjectStatus (the selection)
But it’s not working.
Is there a way of doing it?


Sure, here's one way:

MyEO.java:
        
        // Set the default status for new EO
        public void awakeFromInsertion(EOEditingContext ec) {
                super.awakeFromInsertion(ec);
Status status = Status.statusForCode(ec, "new"); // A method that returns a specified status
                this.addObjectToBothSidesOfRelationshipWithKey(status, 
"status");
        }

MyComponent.java:
        
        public Status statusItem;

        public NSArray projectStatusList() {
                // Return all statuses
        }

        public Status selectedStatus() {
                return myEO.status();
        }

        public void setSelectedStatus(Status s) {
                myEO.addObjectToBothSidesOfRelationshipWithKey(status, 
"status");
        }

MyComponent.wod

StatusPopup:WOPopupButton {
        list = projectStatusList;
        item = statusItem;
        selection = selectedStatus;
        displayString = statusItem.message;
}

        

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to