set_on_tp_popup
This function is used to register a callback function to check the popup message
when the tp_popup command is used in DRL.
It is useful when functions that should be executed automatically are made.
Definition
DRFLEx.h within class CDRFLEx, public section (line 639)
void set_on_tp_popup(TOnTpPopupCB pCallbackFunc) {
_set_on_tp_popup(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
pCallbackFunc |
Refer to definition of callback function |
Return
None
Example
// Callback function to handle popup events from TP
void OnTpPopup(LPMESSAGE_POPUP tPopup)
{
printf("-------------------------------------------\n");
printf("[TP POPUP DETECTED]\n");
printf("Popup Message : %s\n", tPopup->_szText);
printf("Message Level : %d\n", tPopup->_iLevel);
printf("Button Type : %d\n", tPopup->_iBtnType);
printf("-------------------------------------------\n");
// Example: handle based on popup message or level
if (strcmp(tPopup->_szText, "Confirm Start?") == 0)
{
printf("[Host] Sending OK response to controller...\n");
drfl.tp_popup_response(POPUP_RESPONSE_OK);
}
else if (tPopup->_iLevel == 2) // Warning level popup
{
printf("[Host] Warning received from TP. Logging event...\n");
// Log or take action (e.g., slow down motion)
}
else
{
printf("[Host] Display only popup - no action required.\n");
}
}
// Register the popup callback
drfl.set_on_tp_popup(OnTpPopup);
// Main program logic
printf("Waiting for popup events from Teach Pendant...\n");
while (true)
{
// Maintain connection and check callbacks
this_thread::sleep_for(chrono::seconds(1));
}
When registered, this callback function executes automatically when a popup message is triggered on the Teach Pendant (TP) through DRL. It allows the user to check popup content, message level, and button type, and optionally send a response back to the controller (e.g., OK / Cancel). This enables dynamic handling of TP-side prompts such as confirmations, warnings, or notifications during robot operation.