IMGUI_APIboolBeginPopupContextVoid(constchar*str_id=NULL,intmouse_button=1);// helper to open and begin popup when clicked in void (where there are no imgui windows).
IMGUI_APIboolBeginPopupModal(constchar*name,bool*p_open=NULL,ImGuiWindowFlagsflags=0);// modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside)
IMGUI_APIvoidEndPopup();// only call EndPopup() if BeginPopupXXX() returns true!
IMGUI_APIboolOpenPopupOnItemClick(constchar*str_id=NULL,intmouse_button=1);// helper to open popup when clicked on last item. return true when just opened.
IMGUI_APIboolOpenPopupOnItemClick(constchar*str_id=NULL,intmouse_button=1);// helper to open popup when clicked on last item (note: actually triggers on the mouse _released_ event to be consistent with popup behaviors). return true when just opened.
IMGUI_APIboolIsPopupOpen(constchar*str_id);// return true if the popup is open
IMGUI_APIvoidCloseCurrentPopup();// close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.
// (If you want to show the current selection inside the Button itself, you may want to build a string using the "###" operator to preserve a constant ID with a variable label)
// When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem().
// BeginPopupContextItem() will use the last item ID as the popup ID.
// In addition here, we want to include your editable label inside the button label. We use the ### operator to override the ID (read FAQ about ID for details)
staticcharname[32]="Label1";
charbuf[64];sprintf(buf,"Button: %s###Button",name);// ### operator override ID ignoring the preceding label
ImGui::Button(buf);
if(ImGui::BeginPopupContextItem())// When used after an item that has an ID (here the Button), we can skip providing an ID to BeginPopupContextItem().