Immediate-Mode-UI / Nuklear

A single-header ANSI C immediate mode cross-platform GUI library
https://immediate-mode-ui.github.io/Nuklear/doc/index.html
8.86k stars 535 forks source link

After set an opened Combo Box to invisible, no response from the entire window. #623

Open Zimengzhou opened 3 months ago

Zimengzhou commented 3 months ago

Here's a window, with a button and a ComboBox in it.

image

  if (nk_begin(ctx, "test_window",nk_rect(600,100,260,300),NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_TITLE))
  {
      /*  Button   */
      nk_layout_row_dynamic(ctx, 35, 1);
      if(nk_button_label(ctx, "Button"))
      {
          printf("button\n");
      }

      /*  Combo   */
      if (isShowComboBox)
      {
          if(nk_combo_begin_label(ctx, "Demo Combo",nk_vec2(300, 100)))
          {
              nk_layout_row_dynamic(ctx, 18, 1);
              nk_combo_item_label(ctx, "combo_item_label2", NK_TEXT_LEFT);
              nk_combo_item_label(ctx, "combo_item_label2", NK_TEXT_LEFT);
              nk_combo_end(ctx);
          }
      }
  }
  nk_end(ctx);

The flag isShowComboBox is used to control whether the combo is visible。
Use a Key to set value of isShowComboxBox , true or false. Leave the Combo open, then I set the isShowComboBox to false. So, from the next frame, combo disappear as expected.
Set isShowComBox = true again, the combo is visiable, But all the things in the window have no response to my input, can't click Button, can't move window, can't open the content of ComboBox.

When this happen, I click or just move the mouse in other nuklear windows, and back to this window, everything return normal.