Search Unity

GUI.BringWindowToFront() and ToolTipBubble Windows

Discussion in 'Immediate Mode GUI (IMGUI)' started by pogoli, Jun 23, 2008.

  1. pogoli

    pogoli

    Joined:
    May 30, 2008
    Posts:
    41
    I am making a tool tip window class and need to make sure it is always in front of any other windows on the screen, especially the window its tooltipping on.

    I am setting up my window in WindowFullOfButtonsWithToolTips::OnGui() by calling GUI.Window(id, rect, drawCallback,...).

    I am setting up the tool tip window in ToolTipWindow::OnGui() by calling GUI.Window(id, rect, drawTipText, ...).

    At the end of drawCallback (for the main window) I am calling GUI.BringWindowToFront(tooltipWindowId).

    The problem I am running in to is that sometimes when I call GUI.BringWindowToFront(tooltipWindowId) it fails to find the window because its GUI.Window() hasn't been called yet this frame. I made sure to only bring it to the front during the repaint event, but I still get the occasional windownotfound error and the tipwindow doesn't get pulled to the front all the time (during button click events for instance).

    Is there a way to check to see if the window ID exists yet before calling BringWindowToFront(tooltipWindowId)? Also is there another, perhaps better, way to guarantee that my tooltip window always appears on top of all the others.

    Thanks!

    ~Aaron
     
  2. pogoli

    pogoli

    Joined:
    May 30, 2008
    Posts:
    41
    I found that if I called BringToFront() when each window is initially shown, and then every OnGui call for the tooltip window, that worked out alright.

    I'd still like to know if there is a way to check if a window with a given ID exists or not.
     
  3. pogoli

    pogoli

    Joined:
    May 30, 2008
    Posts:
    41
    to follow that reply to my own post up with another reply... that actually didn't work so well. Some windows did not behave as expected. So back to my original question.

    And another one, why don't repeated calls to BringWindowToFront() at the end of a windows's draw callback trump a single call to BringWindowToFront() made at the end of that windows draw callback, but done only once????