.. _cb_tontppopupcb: TOnTpPopupCB ------------------------------------------ This callback is executed when a **user pop-up feature** is triggered in the robot controller. It allows developers to handle or log pop-up events displayed on the teach pendant (T/P) UI. See :ref:`Rules for callback functions `. **Defined in:** ``DRFLEx.h`` .. code-block:: cpp // typedef (DRFLEx.h) typedef void (*TOnTpPopupCB)(LPMESSAGE_POPUP); // registration API (internal + wrapper) DRFL_API void _set_on_tp_popup(LPROBOTCONTROL pCtrl, TOnTpPopupCB pCallbackFunc); void set_on_tp_popup(TOnTpPopupCB pCallbackFunc) { _set_on_tp_popup(_rbtCtrl, pCallbackFunc); }; **Parameter** .. list-table:: :header-rows: 1 :widths: 20 25 15 40 * - Parameter Name - Data Type - Default Value - Description * - tPopup - :ref:`MESSAGE_POPUP ` - - - Pointer to the pop-up data: ``_szText`` is the message text, ``_iLevel`` the level (0: message, 1: warning, 2: alarm) and ``_iBtnType`` the button type (0: Resume/Stop, 1: OK). **Return** |br| None **Example** .. code-block:: cpp #include "DRFLEx.h" #include #include #include using namespace DRAFramework; using namespace std; // Callback triggered when a user pop-up message appears on the TP void OnTpPopupCB(LPMESSAGE_POPUP tPopup) { if (!tPopup) return; cout << "[TP POPUP]" << endl; cout << "Message : " << tPopup->_szText << endl; cout << "Level : " << static_cast(tPopup->_iLevel) << endl; cout << "Buttons : " << static_cast(tPopup->_iBtnType) << endl; // You can log or trigger additional actions here } int main() { CDRFLEx drfl; // Connect to the robot controller if (!drfl.open_connection("192.168.137.100")) { cout << "Failed to connect to controller." << endl; return -1; } // Register TP popup callback drfl.set_on_tp_popup(OnTpPopupCB); // Keep alive to monitor TP popup events while (true) std::this_thread::sleep_for(std::chrono::seconds(1)); drfl.close_connection(); return 0; } **Notes** - This callback is invoked when the robot controller triggers a **teach pendant pop-up** (e.g., alert messages, user confirmation dialogs, or DRL-generated pop-ups). - Common use cases include **logging**, **custom alert handling**, or **debug message tracing**.