Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Issue using setFlagsItem C++ API

#1
Hi everyone,
I need to set flags on specific items to control user interaction with my station.

I need to set let's say selectable and enabled to my robot only. I used this command
Code:
RDK->setFlagsItem(33,itemRobot);

Unfortunately, it seems that now every item is affected by these flags.
I noticed in my console output the string "Statusbar:  "Item name changed to: ..."" being repeated as many times as the item count in the station, everytime with a different name.

When I need to set flags to every item I use this code:
Code:
QList<Item> list = RDK->getItemList();
for(int i = 0; i < list.length(); i++)
    RDK->setFlagsItem(33, list[i]);

This makes RoboDK interface freeze and I see the statusbar string being printed infinite times (item count * number of iterations).
Do you know what I'm missing? Thanks in advance!
#2
Hi StefanoCava,
It looks like you are using an outdated version of the C++ API.
Try to download the latest version from the repository: https://github.com/RoboDK/RoboDK-API/tre...er/C%2B%2B
For example, the function:
Code:
setFlagsItem(Item item, int flags = FLAG_ITEM_ALL)
takes an Item object as the first argument and flags (number) as the second argument.
And you have exactly the opposite.

UPDATE
I dug a little deeper and assumed you were using the Plug-in Interface, not the C++ API.
In that case your code is correct, this function is indeed defined like this in Plug-in Interface:
Code:
virtual void setFlagsItem(int flags = FLAG_ITEM_ALL, Item item = nullptr)

This means that the error is contained in RoboDK's internal code.
We will try to fix it as soon as possible and release a new version.
#3
Hi Dmitry, sorry for the misleading post! Yes, I am indeed using the plugin interface.
I wait for a new version! Thank you for your reply and have a good day
#4
Can you provide example code and an RDK file to reproduce this issue?
  




Users browsing this thread:
1 Guest(s)