Accessing Var from main Nib/Class - [global variables]

I'm sure this is a simple solution and the problem is I'm just not thinking right. I just started programming in Objective C but have come a long way in the past 2 weeks. Pretty extensive knowledge in C# and some java.
Anyways, I've been creating an app and have streams working, CFNetwork working, network services discovery working and a tab bar with a custom View controller linking to one of the tab-bar buttons.
So when you click on one of the tab bar items it opens a new nib file. That nib loads a table view. When nib loads it hits a method which starts looking for network services and updates the table when it finds some.
Now the idea is is to have a selector on the cell and when you choose the service it adds same variable info, ip and port, back to a global variable which can be used through the entire app and all extra loaded nib files.
Out of all this, I don't know how to access global variables....prob should be the simplest thing to do out of all I've done. I have ideas of how it should be done but don't know how to access it.
Idea would be:
MainWindowNib has NSString var that is public with a getter setter. But how can I access that MainWindowNib var from a SecondView.nib file/class. There a way to get the parent of the secondView.Nib? I have no clue.
Any help would be great!
Thanks!

I'm still a bit confused how you access that method.
Main.nib class : UIApplication
NSString *port
SetupView.nib : NSViewController
view
-TableView added to view
-Seperate NSObject for TableViewDelegates
-When item selcted, pass NSString to [main port]
How do I get a pointer to port. I don't really understand how to do this with objective C.
In C# I would be something like: [Not exact syntax but u get the idea]
public Main : Form
public string port{get;set;}
Main()
sView SeconddForm = new SecondForm(this);
public SecondForm : Form
SecondView(Main main)
main.Port = "8080";
Message was edited by: Clarke76
Message was edited by: Clarke76

Similar Messages

  • Few basic doubts about accessing AM from backing bean class

    Hi ADF experts,
    I have just started working in ADF Faces.I made a sample search page.My page is attached to a managed backing bean. I have attached command button on my page to a custom method in backing bean class.
    So on, click of button this method is called in backing bean.Now, i have few doubts:
    1)How to get values of various UI beans in this event code?
    2)I am accesing AM , in my method with this code:
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExternalContext extContext = facesContext.getExternalContext();
    Application app = facesContext.getApplication();
    DCBindingContainer binding = (DCBindingContainer)app.getVariableResolver().resolveVariable(facesContext, "bindings");
    //Accessing AM
    ApplicationModule am = binding.getDataControl().getApplicationModule();
    iS this correct ?
    3) After getting handle of am how to call my custom method in AM Class?there was "invokeMethod" API in application module class in OAF, is there any such method here?
    Please help me.
    --ADF learner.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thanks for ur response Frank, actually I am from OA Framework back ground.It would be great if help us a little with ur valuble thoughts.
    OA Framework also uses bc4j in model layer of framework. We have a requirement where our existing developers from OA Framework have to move to ADF to make a new application where time lines are quite strict.If this would not be possible we will switch to plain jsp and jdbc,but our tech experts say ADF Faces is the best tech.
    In OA Framework, Application Module is key class for all busiess logic and Controller is used for page navigation. So, I m just trying to find the same similarity , where we write we add all event codes in custom action methods in the backing bean class of page, which we consider equivalent to process form request method in Controller class of OAF.
    But there are two things, I still want to know:
    1)While page render, how to call specific AM methods(like setting where clause of certain VOs)
    2)In action methods, the way i described(I found that in one thread only)to access AM, what is wrong in that?Also, I went through
    http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    where coule of examples use similar approach to access AM from backing bean class and call custom methods of AM(Doing various, deletes etc from VOs).
    3)In these methods can we set any property of beans on the page, I am asking because in OAF, generally we use PPR for js alternatives.But all properties of beans cannot be set in post event.
    Thanks and Regards
    --ADF Learner                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Making dll from VI containing labview global variable ?

    I've made dll from VI containing labview global variable.
    But, when I write a c program calling a function from the dll, it returns just error.
    The goal is to read a labview global variables from c program. What can i do for it ?

    Hi
    If you don't use the dll in your LV app, it will be difficult, because it will be in the adress-range of you c app. So any writing of values to the global variable in LV, won't affect the variable in the dll.
    What you can do is some kind of client-server architecture. You need a third app, which just does the data exchange - so you should be able to write a value from LV and read it from c.
    There already have been discussions about similar topics - just search the forum.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • Accessing class var from main timeline

    Hi all! Well I've been working on this for a couple of days
    now and just can't seem to get it to work right...... I'm still
    getting my feet wet with as3 and like it more and more everytime I
    use it.... almost.
    Anyways, here's where I'm running into trouble.
    Here's a dumbed down version of my project with all the other
    usless drivel excluded. Basically what I'm trying to do is declare
    a var and give it a value in my class. Then I want to be able to
    display that value on the stage and use it in the main timeline.
    Seems simple enough....
    I need to be able to pass the var from the class to the main
    timeline for use.... Any help on this would be GREATLY appreciated.
    Thanks.

    kglad, worked like a charm in my short test file... however
    in my real world flash file the class takes a short time to
    actually compute the value of the variable. If I fire the trace
    from the main timeline it will display NaN b/c at the moment it
    fires the value of the var doesn't exist b/c it has yet to be
    calculated......
    I don't really know the best way to delay this... would the
    best way be to somehow add an event listener to listen to the var
    to see when it is assigned a value?.... I'm open to suggestions.
    btw, good catch on the assignment of a string value!!
    Thanks!

  • Help me which JNDIFactory to use to access EJB from a java class of JAR

    I am confused in understanding the different JNDI factories
    RMIInitialContextFactory, ApplicationInitialContextFactory and ApplicationClientInitialContextFactory
    And the different namespaces like global, container local and component local.
    Especially is there any relationship between the JNDI factories and the namespaces?
    Or are they related to the deployment descriptors.
    Because in application specific deployment descriptors (orion-ejb-jar.xml), we just map the JNDI location with the object (or its reference from ejb-jar.xml). We dont specify it can be accessed from this factory or that.
    Shall we access an EJB from using any JNDI factory?
    Specifically, I am stuck with what Factory to use to access an EJB from a Java class in a library (jar). The JAR is packaged with the EAR which contains the EJB Jar that I am trying to access.
    THANK YOU

    Ed,
    As Robin said, I think you need code similar to this:
    Context c = new InitialContext();
    Object o = c.lookup("java:comp/env/Name");where Name is the name of your EJB as it appears in the "ejb-jar.xml"
    deployment descriptor XML file.
    Good Luck,
    Avi.

  • Accessing ServletContext from non-servlet class

    How i can get information servletcontext from a normal java class?
    I am using Tomcat.
    I have put some Strings in to the servlet context and i want to get this information from a normal java class.
    I think there was a way to do it with getServlet() but this is deprecated.

    One way to do this would be to store the info in some class of your own as a static member(arraylist/hashmap or something) and then retrieve it from your java class.
    May you can populate static field i the init() method of one of your servlet and have that servlet load on tomcat startup.

  • Access var on main timeline from class

    Hello,
    Currently working on some expanding media that has class files for all of the various action functions, then a separate class file for all of the var that sets the graphics, tracking, copy / content and whatnot.
    The final part that's driving me nutty - how to set a var per .swf that will concatenate with the tracking.  Ideally I'd like to get this as automated as possible so if I pass off the files to other designers they can update it quickly with minimal effort.
    Assets:
    unit 1a
    300x250 banner
    728x500 expanded larger content area
    unit 1b
    728x90 banner
    728x90 expanded larger content area (that is a duplicate of the 300x250 content .swf).
    So with tracking, each banner and expanded area would have individual tracking pixels.  Currently I can get all of the pixels to fire properly per unit however I have to have separate functions so there's no overlap and a number of duplicate naming.  Druthers-wise what I would have is the type of unit passed when the pixel function is triggered for the larger expanded sizes.  For example =
    User clicks on unit 1b button, this triggers the buttonClickTracking(); function (which is in the actions class file, shared by both unit 1a and unit 1b)..  unit 1b would have some var in the timeline so that when that function is called, the pixel will have "unit1b" + tracking.pixel;
    To sum it up, I need to set some var on the timeline for each expanded unit so the unit label (id) is called when any of the various tracking functions are initiated.  Right now getting that ID from each of the larger content .swf eludes me so any suggestions would be greatly appreciated!

    i could not understand what you're trying describe.

  • [Dynamic Tabs UI Shell Template] Access AM from main page

    Hi
    I am using JDeveloper 11.1.2.1
    I have a doubt about UI Shell Template. I'm using this template and this user data map implementation to store user preferences:
       http://andrejusb.blogspot.com.es/2012/05/solution-for-sharing-global-user-data.html
    I use this solution because I need to share the user language in the view layer and the BC layer (some viewObjects depend of language)
    I have a use case where I need to change the user data map from a managed bean (the user changes your favorite language from UI). Because I use the UI Shell template with several BTF in ADF libraries I don't know how can I access the application modules of these BTFs or the DataControls from the managed bean in the main project that contain the home page based on the UI Shell Template.
    Any suggestion will be appreciated.
    Thank you

    Hi User,
    you need to look for customizing the UI shell template.
    here are few articles may help you to customize the default UI shell template.
    Techie gossip: ADF talk: customize the logo inside Dynamic Tab UI Shell
    Andrejus Baranovskis's Blog: Building Custom UI Shell with ADF 11g R2

  • Read structure from main program class??

    Hi all,
    I know that i can read the structures from the main program with (program)structure
    But now the structure is in a class or form... How can i do this?
    regards

    Hi,
    I want to use BADI WORKORDER_CONFIRM_CUST_SUBSCR and I have created my own subscreen.
    The fields are displayed in the transaction CO11N but the fields are not transfered to the table AFRU where i have created the fields...
    And the BADI is already implemented by SAP.. No multiple use possible...
    I don't know how the data from the screen can be inserted in the table AFRU without modification.
    regards

  • Access servlets from subdirectory of classes folder

    Hi,
    This is my directory structure.
    Tomcat home dir>webapps\lessons\WEB-INF \classes\examples\HelloClientServlet.class
    and here is my web.xml
    <servlet>
    <servlet-name>HelloClientServlet</servlet-name>
    <servlet-class>examples.HelloClientServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloClientServlet</servlet-name>
    <url-pattern>/servlet/examples.HelloClientServlet</url-pattern>
    </servlet-mapping>
    Now I run run Tomcat and try to access the URL
    http://localhost:8083/lessons/servlet/examples.HelloClientServlet
    It gives this ERROR:
    javax.servlet.ServletException: Error allocating a servlet instance
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.NoClassDefFoundError: examples/HelloClientServlet (wrong name: HelloClientServlet)
    java.lang.ClassLoader.defineClass0(Native Method)
    java.lang.ClassLoader.defineClass(ClassLoader.java:539)
    Now here is the problem. I tried putting HelloClientServlet.class in classes directory and made appropriate changes to web.xml and it works.
    But not in the subdirectory classes. I find it very strange. I feel there is no problem with my web.xml file. Am I am missing some configuration here.
    Please give you inputs.
    Thanks,
    Tick_Tick

    When you put the HelloClientServlet class in the examples folder and reference it using examples.HelloClientServlet then the class needs to be compiled in the examples package.
    Check out the Java tutorial on packages:
    http://java.sun.com/docs/books/tutorial/java/interpack/index.html

  • Can LabVIEW global variables be shared between UUT sequence steps in the parallel sequence model?

    Sorry for this simple question,  I'm having a hard time finding this answer.
    If I launch a sequence to run on two UUTs in the parallel sequence module,   can I get both UUTs to run LabVIEW vis that use global variables such that :
    1) UUT 0  executes 20 LabVIEW Vi  steps asynchronously,  5 of which access data from LabVIEW global variables A, B, C (Strings)
    2) UUT 0 executes the same 20 LabVIEW based steps asynchronously  5 of which access data from then same LabVIEW global variables A, B, C (Strings)
    I am a little worried that using file globals may have some delays or more of a race condition than using native LabVIEW global variables like in a single labview application perform.  
    QUESTION 2:  Are file globals actually written to the hard drive and shared between parallel sequences through file transfer?  OR  are they in memory?
    Brad Whaley
    LabVIEW Certified Engineer

    Hi bdwhaley,
    Are your parallel sequences only reading from the global variable? Or are they writing to the variable as well? If it is just reading, then you should be okay. File globals are read from memory. Every time they are read, a copy of the data is made in memory.
    Humphrey H.
    Applications Engineer
    National Instruments

  • Global Variable in report

    i am working with some global variables in all of my application including forms and reports. the global variables are created in the when new-form-instance trigger of the main form. the global variables are accessible throught the forms but i d,not know how i can access the same global variables in my reports. pls some one help me to solve the problem.

    If you only want to read the global parameters in Reports, you can pass them as parameters. Otherwise, you must put your global variables into a database table, for forms and reports are not sharing the same session.

  • Target movieclip from an AS3 class file - remove/add Child

    Halo.
    I have a very simple question  (for those who use external class files).
    Assuming that I have a MovieClip manually added to Stage and I want to access it from inside my class definiton.
    So the code would be:
    MovieClip(root).MyMovieClip
    But I can't figure out how to use remove/add Child in that kind of situation.
    I will appreciate any advice.
    Thanks

    if you can reference using that, you can remove using:
    MovieClip(root).MyMovieClip.parent.removeChild(MovieClip(root).MyMovieClip);
    and you can add to any displayobjectcontainer.

  • Call function, pass value, access variable in movieclip class from main stage

    i am new to flash as.
    I got quite confused on some problems. as the function here
    is quite different from c and asp.net.
    I have a movieClip named MC, and it's enabled with action
    script, with the class name MC_Rectangle
    and a Stage.
    I override the MC_Rectangle class file in a mc_rectangle.as
    external file.
    here is the code:
    package{
    import flash.display.*;
    import flash.events.*;
    public class MC_Rectangle extends MovieClip {
    var sequence:int = new int();
    function setSequence(data:int):void{
    sequence = data;
    function addSequence():void{
    sequence ++;
    I have new a object in the main stage var
    mc_rect:MC_Rectangle = new MC_Rectangle()
    question:
    in main stage:
    1. how can i access the variable "sequence" in "mc_rect"
    2. how can i pass parametre from main stage to mc_rect via
    function setSequence(data:int)?
    3. how can i call the function in addSequence() in mc_rect.
    in asp.net, i usually use mc_rect.sequenct,
    mc_rect.setSequence(data), mc_rect.addSequence() to achieve my
    goals......
    btw, can function in mc_rect return out result to main stage?
    thanks in advance.

    Your as-file must be named MC_Rectangle.as (same upper/lower
    case as in the Class name)
    Ad 1) You have to declare sequence as a public property
    "public var sequence;" or - better - define a getter-function for
    sequence.
    Ad 2) mc_rect.setSequence(8); e. g. (you must write "public"
    in the Class-declaration of setSequence)
    Ad 3) mc_rect.addSequence(); e. g. (you must write "public"
    in the Class-declaration of addSequence)
    ... and yes, your methods can return a value: Replace "void"
    with the proper data type (int, String, ...) and place a "return
    myNumber;" or the like in the method's body.

  • Accessing a class private variable in the main timeline

    Greetings,
    noob question.
    Here's my main class:
    package
         import flash.external.ExternalInterface;
         public class main
             public function main()
             public function check_DVBViewer()
                 ExternalInterface.call("check_DVBViewer","test");
                 ExternalInterface.addCallback("AutoIT",AutoIT);
             private function AutoIT(my_msg:String)
                     // here we get the callback string
    in the timeline I have a dynamic text box named my_textbox:
    var my_test:main = new main();
    my_test.check_DVBViewer();
    my_textbox.text = ???????
    Basically the class waits for the callback variable (my_msg).
    The problem is: I need to set the dynamic textbox text to my_msg variable.
    How can I access it?
    I know I can access a public var in the timeline with functioname.variable but I can't define a public var inside a function, right?
    Thank you very much for your time.

    dispatch an event when the string is ready:
    package
         import flash.external.ExternalInterface;
         public class main
    private var msg:String;
             public function main()
             public function check_DVBViewer()
                 ExternalInterface.call("check_DVBViewer","test");
                 ExternalInterface.addCallback("AutoIT",AutoIT);
             private function AutoIT(my_msg:String)
                     // here we get the callback string
    msg=my_msg;
    dispatchEvent(new Event("stringready"));
    public function get msgF():String{
    return msg;
    in the timeline I have a dynamic text box named my_textbox:
    var my_test:main = new main();
    my_test.addEventListener("stringready",f);
    my_test.check_DVBViewer();
    function f(e:Event):void{
    my_textbox.text = my_test.msgF;

Maybe you are looking for