RoboDK Forum
ItemUserPick froze in the c++ sample application- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+ - - - Forum: RoboDK bugs (//www.sinclairbody.com/forum/Forum-RoboDK-bugs)
+--- Thread: ItemUserPick froze in the c++ sample application (/Thread-ItemUserPick-froze-in-the-c-sample-application)



ItemUserPick froze in the c++ sample application-flauzon-08-23-2021

In some case, the ItemUserPick() method will make the whole application froze.
To reproduce using the existing C++ Sample application, simply:

- start the sample
- click on "Integrate RoboDK Window"
- add a first robot in the station, then a second, then a reference frame (like in the attached screenshot)
- click on the "Select Robot" button

The sample is frozen.

I have the same problem with our integration of RodoDK window inside a Qt application.


RE: ItemUserPick froze in the c++ sample application-Albert-08-24-2021

I think this issue is related to RoboDK's main loop being blocked when you use a Qt application. This issue will happen when you use embedded windows with RoboDK and you display a blocking dialog from RoboDK using the API.

You could create your own version of this popup box (ItemUserPick) by retrieving all the items and let the user choose one.


RE: ItemUserPick froze in the c++ sample application-flauzon-08-24-2021

Yes that is what I did.
这是我所做的直接在c++ api:

Item RoboDK::ItemUserPick(const QString &message, int itemtype) {
QList item_list=getItemList(itemtype);
if (item_list.isEmpty())
return Item();
else if (item_list.count()==1)
return item_list.first();

// use Qt to select an item
QStringList item_name_list;
for (int i=0; iitem_name_list.append(item_list.at(i).Name());
bool ok;
QString item = QInputDialog::getItem(qApp->activeWindow(),message , message, item_name_list, 0, false, &ok);
if (ok==false || item.isEmpty())
return Item();
int index=item_name_list.indexOf(item);
return item_list.at(index);

}

Maybe the c++ api could be update in a similar way to the ItemUserPick() will always work?

Best regards,
Francois.