GetItem of PmfTreeItem object by Id

This is the main technical forum for discussing problems that were encountered by users while developing PROMOTIC applications, and their possible solutions.

GetItem of PmfTreeItem object by Id

Postby roman66 » Fri 11. Apr 2025 17:26:38

Hi,
Need to change Text color of some TreeItem on refresh and got variable with TreeItem Id..
I tryed :
Code: Select all
var oForm = pMe.Form;
var oTreeMenu = oForm.GetItem("TreeMenu");
var oRoot = oTreeMenu.TreeRoot;
var oItem = oRoot.GetItem(0,"IdX");
oItem.TextColor = "#ff6868";


but oRoot.GetItem need the path of Id-s

does it possible to get TreeItem object only by his 'Id'? Of course all Id-s is unique.
newbie
PM 9.0.31.3 64bit
roman66
 
Posts: 20
Joined: Tue 09. Jul 2024 12:07:38

Re: GetItem of PmfTreeItem object by Id

Postby Ondřej Kovařík » Mon 14. Apr 2025 8:51:15

Hello, thank you for asking.
Neither the GetItem() method nor any other method of the PmfTree object or the PmfTreeItem object can search the whole tree and find the item by its identifier (Id).
If we call the oItem.GetItem() method and specify the item identifier as the second parameter, the method will search for the desired item only among the direct subitems of the oItem item:
Code: Select all
var oChild = oItem.GetItem(0, "IdX"); // returns the subitem of the "oItem" item with the identifier "IdX"
Ondřej Kovařík
 
Posts: 32
Joined: Thu 13. Dec 2012 10:10:15


Return to I don't know how to...

Who is online

Users browsing this forum: No registered users and 13 guests

cron