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: Fri, 28 Feb 2003 08:57:43 -0800
Jonathan,
...
>I think the problem is in getting the selectin to List just the selected
>popup item such as "Home", "Reference", "Terms" etc.... everything else
>seems to work fine otherwise
>
The only way you will achieve this is to bind the popup to a list of
strings. This, I feel, is the wrong solution. You have objects, use
objects. Don't rape their attributes out and use them for something else.
So we have a list of TbNavPage, and the one the user selected is in
selectedTbNavPage(). You want the reference. What is wrong with just
doing this? selectedTbNavPage().reference()? Thus search like this:
public void selectObject() {
// What is this line here for? This is the same as
//tbnavpageDisplayGroup.selectObject(null);
tbnavpageDisplayGroup.selectObject(tbnavpage);
// Modified search. Selects based on reference (name) of
selectedTbNavPage().
tbnavpageDisplayGroup.selectObject(selectedTbNavPage().reference());
}
Keeping in mind that I don't use (and don't know) display groups. Looking
at the docs, the above seems unlikely to be what you want, but hopefully
this will point you in the right direction anyway.
Chuck
At 04:34 PM 28/02/2003 +0000, Jonathan Fleming wrote:
>Ok Chuck,
>Time to tidy my act up.
>When I pasted in the original message I saw that the PopUp was called
>"CategoryPopUp" and changed it to something more appropiate like
>"NavPagePopUp_inQueryForm" in the WOBuilder WOD File but forgot to do it on
>the post as I was in such a rush. So I apologise for causing you confusion
>there. I took the popup from the categories page and pasted it in my
>navAddEditPage, again to save Time when changing the bindings because the
>setup was similar.
>
>Anyhow the binding are now changed to:
>NavPagePopUp_inQueryForm: WOPopUpButton {
> displayString = tbnavpage.navPageName;
> item = tbnavpage;
> list = sortedNavPageNames;
> selection = selectedTbNavPage;
>}
>
>The relevant details on the page now look like this:
> protected TbNavPage tbNavPage;
> protected TbNavPage selectedTbNavPage;
> protected TbNavPage selectedTbNavPageToSearch;
>
> ---------------------------------------
>
> public TbNavPage selectedTbNavPage() {
> return selectedTbNavPage;
> }
>
> public void setSelectedTbNavPageToSearch(TbNavPage newSelection) {
> selectedTbNavPage = newSelection;
> }
>
> public TbNavPage selectedTbNavPageToSearch() {
> return selectedTbNavPageToSearch;
> }
>
> ---------------------------------------
>
> public void selectObject() {
> tbnavpageDisplayGroup.selectObject(tbnavpage);
> tbnavpageDisplayGroup.selectObject(selectedTbNavPage());
> }
>
>
>What I am actually trying to achieve is for the popup to act as if I have
>written the String (eg. "Home" or "Contact" or "Terms" or "Reference", etc.)
>into the WOTextField box that it has replaced.
>if the actual text box is in place it would be bound to this:
>
>navPageNameQueryField: WOTextField { value =
>tbnavpageDisplayGroup.queryMatch.navPageName;
>size = 10;
>name = "navPageName";
>};
>
>And when used of course it works perfectly.
>But in the selectedTbNavPage iVar I am getting this:
>
>{values = {visibility = <com.webobjects.foundation.NSKeyValueCoding$Null>;
>status = <com.webobjects.foundation.NSKeyValueCoding$Null>; navPageName =
>"Reference"; navPageContent =
><com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<TbNavPage
>61dfb5 _EOIntegralKeyGlobalID[TbNavPage (java.lang.Long)3]>"; }
>
>not "Reference" which is what i need to achieve i believe....
>
>I think the problem is in getting the selectin to List just the selected
>popup item such as "Home", "Reference", "Terms" etc.... everything else
>seems to work fine otherwise
>
>
>I hope I am not confusing you this Time around.
>
>Thanks
>Jonathan
>
>
>
>>From: Chuck Hill <email@hidden>
>>To: "Jonathan Fleming" <email@hidden>,
>>email@hidden
>>Subject: Re: WOPopUpButton Used For A Search
>>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
>
>
>_________________________________________________________________
>Overloaded with spam? With MSN 8, you can filter it out
>http://join.msn.com/?page=features/junkmail&pgmarket=en-gb&XAPID=32&DI=1059
>
>
--
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.