Re: WOPopUpButton Used For A Search
Re: WOPopUpButton Used For A Search
- Subject: Re: WOPopUpButton Used For A Search
- From: Chuck Hill <email@hidden>
- Date: Thu, 27 Feb 2003 21:08:31 -0800
Hi Jonathan,
I've looked over the previous messages on this and I must admit that I am
little confused at to what you are trying to achieve. If you can post a
little more details (e.g. what object, what types, what attributes, why,
etc.) on what you are trying to achieve you may get some better ideas back
in return.
OK, back to the problem at hand. First, lets start with the problems:
CategoryPopUp: WOPopUpButton {
displayString = tbnavpage.navPageName;
item = tbnavpage;
That all looks good. Each element in the sortedNavPageNames will be
assigned to tbnavpage and the result of tbnavpage.navPageName() will appear
in the list in the popup.
list = sortedNavPageNames;
Now this confuses me a bit. This is called the CategoryPopUp, yet you seem
to be populating it with TbNavPage EOs. TbNavPage and Category don't seem
to be very similar so I'm wondering if one of them is wrong. Should this
be a list of categories, or should this be called NavPageNamesPopUp?
Paying attention to naming consistency like this will not make your program
run correctly, but will make you (and me!) less confused and be a
tremendous help to anyone who has to work on this code after you.
name = "navPagePopupList";
I'd avoid, wherever possible, using the Name binding. Unless you
absolutely need it you are better off without it.
value = tbnavpage.navPageName;
Same comment here as for Name. Don't use it. It is just cosemetic anyway.
selection = tbnavpage;
RED ALERT! That is your bug, or at least one of them. You have used the
same binding for selection and item. Don't. What ever is bound to item is
set to null after the popup is done. Regardless of what you select,
tbnavpage will be null when you go to use it. Add this to your page:
protected TbNavPage selectedNavPage;
public TbNavPage selectedTbNavPage() {
return selectedTbNavPage;
}
public void setSelectedTbNavPageToSearch(TbNavPage newSelection) {
selectedTbNavPage = newSelection;
}
And change the bindings to this:
CategoryPopUp: WOPopUpButton {
displayString = tbnavpage.navPageName;
item = tbnavpage;
list = sortedNavPageNames;
selection = selectedNavPage;
}
Your world will be a happier place. OK, time for the search. I'm going to
leave this to you as I've never used display groups in my life. Long
story. Maybe you wanted something like this?
public void selectObject() {
tbnavpageDisplayGroup.selectObject(selectedTbNavPage());
}
Chuck
At 10:37 PM 27/02/2003 +0000, Jonathan Fleming wrote:
>Hello George,
>
>I had horrid paper work to do so had to break away from the app, but I'm
>back on it now. I still have a problem and it may be that I am simply brain
>dead or that I just don't know how to do what is needed. I can't work out
>how not to populate the selectedTbNavPageToSearch with the full data / all
>attributes of the TbNavPage Class. Also do I have to create an NSDictionary
>for the queryMatch() method? I lost.
>
>sorry! I've been looking at this with a determination not to run back to you
>or the list for help because I'm feeling rather brainless.
>
>I need your help
>Thanks
>Jonathan
>
>//the iVar
>protected TbNavPage selectedTbNavPageToSearch;
>
>//Your code with uncompleted search code in the "if"
>public void setSelectedTbNavPageToSearch(TbNavPage value) {
>
> selectedTbNavPageToSearch = value;
>
> if (selectedTbNavPageToSearch!=null) {
>
> // add search code here
> tbnavpageDisplayGroup.queryMatch();
>
> }
> }
>
> public TbNavPage getSelectedTbNavPageToSearch() {
> return selectedTbNavPageToSearch;
> }
>
>
>
>
>
>
>>From: George Domurot <email@hidden>
>>To: "Jonathan Fleming" <email@hidden>
>>CC: email@hidden, email@hidden
>>Subject: Re: WOPopUpButton Used For A Search
>>Date: Wed, 26 Feb 2003 09:38:20 -0500
>>
>>You aren't required to use name and value bindings. But, you will need to
>>bind selection to a new variable, say selectedTbNavPageToSearch. Setup a
>>setSelectedTbNavPageToSearch method that accepts the new setting and
>>handles the search, such as:
>>
>>public void setSelectedTbNavPageToSearch(TbNavPage value)
>>{
>>
>> selectedTbNavPageToSearch = value;
>>
>> if (selectedTbNavPageToSearch!=null)
>> {
>>
>> // add search code here
>>
>> }
>>}
>>
>>On Wednesday, February 26, 2003, at 08:13 AM, Jonathan Fleming wrote:
>>
>>>CategoryPopUp: WOPopUpButton {
>>> displayString = tbnavpage.navPageName;
>>> item = tbnavpage;
>>> list = sortedNavPageNames;
>>> name = "navPagePopupList";
>>> value = tbnavpage.navPageName;
>>> selection = tbnavpage;
>>>}
>>_______________________________________________
>>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.
>
>
>_________________________________________________________________
>Stay in touch with absent friends - get MSN Messenger
>http://messenger.msn.co.uk
>_______________________________________________
>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.
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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.