Saturday, October 25, 2014

#1 2012-12-26 05:48:54 am

Rubenrr
Member
Registered: 2009-06-26
Posts: 5

SelectedObject of PopUpButton

I want to set the selection of a PopUpButton at start to my Defaults,
but the first is to control al the aspects of the PopUpButton.

Controlling the changes of the user is easy setting the selection of one item of the PopUpButton to a function,
the complex is to control the PopUpButton from code/UI.

I have this test_project to test the SelectObject from code or UI.
Once property B_years_selected (Selected Object) is set, it can't be edited?!?!?!?!


Applescript:

script test_PopUpButtonAppDelegate
   property parent : class "NSObject"
   
   property mainWindow : missing value
--Binded to Content of the PopUpButton of the UI
   property B_years : {2012, 2013, 2014, 2015} --> works great
--Binded to Selected Object of the PopUpButton of the UI
   property B_years_selected : 2012 --> works great
   
   on applicationWillFinishLaunching_(aNotification)
       set B_years_selected to 2014 --> does not work
       
   end applicationWillFinishLaunching_
   
   on applicationShouldTerminate_(sender)
       return current application's NSTerminateNow
   end applicationShouldTerminate_
end script

I have tried everything i found to pre select an item of the PopUpButton, but nothing works.
Thanks for advance. smile

Browser: Safari 534.57.2
Operating System: Mac OS X (10.8)


Filed under: Button, items, binding, select

Offline

 

#2 2012-12-26 06:12:13 am

StefanK
Member
From: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 10610
Website

Re: SelectedObject of PopUpButton

Hi,

to conform to key-value coding set the property via the accessor method by adding my

Applescript:


set my B_years_selected to 2014


regards

Stefan

Offline

 

#3 2012-12-26 06:18:40 am

Rubenrr
Member
Registered: 2009-06-26
Posts: 5

Re: SelectedObject of PopUpButton

It works!! yikes

Can't believe it.

I just lost a lot of time on something so ridiculous.

THANK YOU  lol

Offline

 

#4 2012-12-26 07:33:44 am

Rubenrr
Member
Registered: 2009-06-26
Posts: 5

Re: SelectedObject of PopUpButton

It works only on the test_project!  sad

In my real project i have 2 .XIB.
One of them (the second) has the option screen where the PopUpButton is located.

Doing the same as in the test_project, it doesn't change the Selected Object.

Applescript:

set my B_year_selected_value

Changes the variable but nothing happens on the Button!!

The bindings are the same.

Please help

Offline

 

#5 2012-12-26 04:33:30 pm

Shane Stanley
Member
From: Australia
Registered: 2002-12-07
Posts: 3707

Re: SelectedObject of PopUpButton

Rubenrr wrote:

The bindings are the same.

The bindings can't be the same. Your app delegate will not even  show up in the "Bind to" popup of the second .xib because the instance belongs to a different .xib. You just can't bind across .xibs like that.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/

Offline

 

#6 2012-12-27 05:07:06 am

Rubenrr
Member
Registered: 2009-06-26
Posts: 5

Re: SelectedObject of PopUpButton

It's true.
Navigating through all the information on these fantastic forums,
I found someone saying to be not afraid to use multiple UI's.

After changing everything to one UI, all the code worked right the first time.

Thanks to people like you, I never go to bed without knowing something new.

Thanks for being there.  lol

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.037 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)