how to get NSPopup button's to show same numbers?

Hi all

I have four NSPopup buttons that have number’s 1 to 6 added to each upon nib waking,
I can change the values in each to be what ever number I choose at the moment, what I am wanting to
add is when a check box is checked to on, have all the NSPopup buttons change to the same
number that is selected in any of the other three popup buttons, can some one help me
to figure this out please, the check box part I have as below.

property Corner_Radius : missing value  --  check box
 property Corner_R : missing value

 on Corner_R_(sender)  --clicked to check or uncheck
 Corner_Radius's intValue() --get state of check box 1 or 0
 if result is 1 then

  ” code for making all popup buttons have the same number
    no matter which popup button has been selected
   
  end if
  end Corner_R_

OSX 10.9.1
Xcode 4.6.3

Do you mean something like this?

UPDATED:

This will simple change them. There is no action for when the check box is unchecked so they stay the same.

i.e if when the check box is checked. The titles are all 1s. Uncheck it they remain All 1s.




    property Corner_Radius : missing value -- check box
    property Corner_R : missing value
     property popUps : missing value -- Popup Button
    on Corner_R_(sender) --clicked to check or uncheck
        Corner_Radius's intValue() --get state of check box 1 or 0
        if result is 1 then
            
           set theSelectedTitle to popUps's selectedItem()'s title
           
           set theItemArray to popUps's itemArray
           repeat with i from 1 to number of items in theItemArray
               
              set this_item to item i of theItemArray
              
             this_item's setTitle:theSelectedTitle
              
              
            end repeat
        end if
    end Corner_R_


This will revert them.

i.e if when the check box is checked. The titles are all 1s. Uncheck it they go back to what they were before.

    property Corner_Radius : missing value -- check box
    property Corner_R : missing value
     property popUps : missing value
     
     property bigList : {}
     
    on Corner_R_(sender) --clicked to check or uncheck
       
        set theItemArray to popUps's itemArray
         set theSelectedTitle to popUps's selectedItem()'s title
        set checked to  Corner_Radius's intValue() --get state of check box 1 or 0
        if checked is 1 then
            
           set bigList to {}
            end if
        
           
           
           repeat with i from 1 to number of items in theItemArray
               
              set this_item to item i of theItemArray
              
             copy this_item's title to end of bigList
              if checked is 1 then
             this_item's setTitle:theSelectedTitle
             
             else
             this_item's setTitle: (item i of bigList)
             
             end if
              
     end repeat

hi mark
thanks for the help

looks promising, I see you have only one ppoup button, I have four
that when if any one is selected, that the number that is selected is then the same in the other three popup’s

my popup buttons are

  property TopLeft : missing value
        property TopRight : missing value
        property BottomLeft : missing value
        property BottomRight : missing value

cheers

Ah I see what you mean…

Hows this

   
    property Corner_Radius : missing value -- check box
    property Corner_R : missing value
    
    
    property TopLeft : missing value
    property TopRight : missing value
    property BottomLeft : missing value
    property BottomRight : missing value
     property thePopupList : {}
     
    on Corner_R_(sender) --clicked to check or uncheck
        set checked to  Corner_Radius's intValue() --get state of check box 1 or 0
         if checked is 1 then
        set thePopupList to {TopLeft,TopRight,BottomLeft,BottomRight}
        set theSelectedItemIndex to sender's   indexOfSelectedItem()
      
         repeat with i from 1 to number of items in thePopupList
            
            set this_item to item i of thePopupList
          
          
                this_item's selectItemAtIndex:theSelectedItemIndex
           end repeat
         end if
    end Corner_R_
    

hi Mark

I tried to get your suggestion to run, but it keeps throwing this error, any ideas?

Hi,

Oddly I was getting that myself at one point but it just stopped?. Not sure what the adjustment was that did it.

But I will have a look and see. I can zip the project I am testing with and email it to you if you want. Just PM me an address.

the error message says that CornerR is connected to a NSButton instead of an expected NSPopupButton

that’s right Stefan, CornerR is connected to the check box, so when it’s checked
Corner_Radius’s intValue() knows that it’s result is either 1 or 0
which then if 1 runs the code, so is there another way to get the info
from the 4 drop box’s, to do what i’m after?

Yer. I just sussed what is going on.

I just created a new projects and hooked up every thing. using the drag from object to the appDelegate.

Running it I started getting the same message.

So I looked at the connection inspector for appDelegate in IB

It turned out although I know I hooked them all up correctly. IB did not save them all connected properly.

So I then selected the appDelegate in IB. and used its connection inspector to disconnect every thing and then connected them correctly using it.

This worked.

Bloody odd though that IB would do this.

thanks Mark

your project pointed out to me that I hadn’t bound Corner_R to the drop box’s, I had it bound
only to the check box

everything works perfectly now

really appreciate the help.