execute at run time

Discussion in 'Mac Programming' started by marcmeezy, Feb 21, 2011.

  1. marcmeezy, Feb 21, 2011
    Last edited by a moderator: Feb 22, 2011

    marcmeezy macrumors newbie

    Joined:
    Feb 5, 2011
    #1
    How can I have an action ran at runtime instead of linking it to a click ect..?

    PHP:
    cellTag = [buyRadioGroup selectedRow];
        
        if (
    cellTag == 0) { 
                
                [
    dispPrice setEditable:(BOOL)flag];
                [
    dispPrice setDrawsBackground:[(BOOL)YES];
                 
            }
    I basically have a radio button that, at run time is already selected and I need the corresponding NSTexTField to not be editable when the radio button is selected.


    I found a way to do it with an if-statement and linking it to an IBAction but that is only executed by a click. :( I need it the radio button to be detected right away so that is disables the NSTextField.
     
  2. ulbador macrumors 68000

    ulbador

    Joined:
    Feb 11, 2010
    #2
    If it's a Mac app, check out either loadView or awakeFromNib. You could also just write your own method and call it before you display it from the parent.
     
  3. marcmeezy thread starter macrumors newbie

    Joined:
    Feb 5, 2011
    #3

    I'm looking into those other two, thanks.

    As for calling it before I display it from the parent, I've tried placing it in the main.xib file :(

    Could you give me an example please?

    Thanks for your help
     

Share This Page