How to identify app is currently show or hide?

Discussion in 'Mac Programming' started by newformac, Jun 6, 2011.

  1. newformac macrumors regular

    Joined:
    May 24, 2011
    #1
    Hi all

    i using this to sho and hide my app

    Code:
    [mainwindow orderOut:nil]; // to hide it
    		  
    [mainwindow makeKeyAndOrderFront:nil]; // to show it
    
    now please tell at running time how can identify the app is show or hide?

    please help me for this.

    thanks in advance.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    [mainWindow isVisible] && ![mainWindow isMiniaturized]
     
  3. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #3
    how can i use isVisible from any other class or window?
     
  4. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #4
    i m using [controlPanel orderOut:nil]; in awakeFromNib but still the window is show.
     
  5. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #5
    Is your goal just to not have the window shown when the nib loaded?
     
  6. newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #6
    not alwaz but in certain condition.
     
  7. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #7
    Try unticking visible at launch in the window property inspector in interface builder. This will stop the window from appearing automatically. Then order the window on screen when you want it to be shown.
     
  8. newformac, Jun 7, 2011
    Last edited by a moderator: Jun 7, 2011

    newformac thread starter macrumors regular

    Joined:
    May 24, 2011
    #8
    thanks its done from awakeFromNib .
    i am automatically start my application using LoginWindow whenever Mac machine is on or whenever any user logged in.

    at this time if i place some alert message in awakeFromNib than app is display otherwise its run in hidden mode,i want to detect the automatically start position to avoid this alert message.

    Code:
    [[NSAlert alertWithMessageText:@"Alert Message"
    			defaultButton:@"OK" alternateButton:nil otherButton:nil
    			informativeTextWithFormat:@"Alert Message"] runModal];
    
    and please also tell me how can i identify the app is show or hide from other class that is derived from NSObject.
     

Share This Page