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

Issue using setFlagsItem C++ API

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

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:
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!
Hi StefanoCava,
It looks like you are using an outdated version of the C++ API.
Try to download the latest version from the repository:
For example, the function:
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.

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:
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.
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
Can you provide example code and an RDK file to reproduce this issue?

Users browsing this thread:
1 Guest(s)