Change TreeItem value Lua

asked 2025-08-26 17:13:52 +0000

Omi gravatar image

We are researching how to add composite values to the protocol tree. It would be ideal to parse the child fields first and update the parent "composite". One thing that is missing is a set_value(). Is there a method to update the "show" value in the protocol tree.

Here is an example of an output in PDML:

    <field name="cme.futures.ilink3.sbe.v8.5.timetoexpiration" showname="Time To Expiration: " size="5" pos="247" show="" value="ffffff7f7f">
      <field name="cme.futures.ilink3.sbe.v8.5.mantissa32" showname="Mantissa 32: No Value" size="4" pos="247" show="2147483647" value="ffffff7f"/>
      <field name="cme.futures.ilink3.sbe.v8.5.exponent" showname="Exponent: No Value" size="1" pos="251" show="127" value="7f"/>
    </field>

Is there a way to update the show="" attribute of the parent? We could generate 2 separate reader functions as an alternate.

Thanks in advance

edit retag flag offensive close merge delete

Comments

(Related to Update parent tree node)

WSDG: 12.7.1. TreeItem
Would 12.7.1.4. treeitem:set_text(text) or 12.7.1.15. treeitem.text work?

Chuckc gravatar imageChuckc ( 2025-08-26 18:23:36 +0000 )edit

When I tried:

time_to_expiration:set_text("O'Doyle Rules")

I got:

<field name="cme.futures.ilink3.sbe.v8.5.timetoexpiration" showname="O'Doyle Rules" size="5" pos="247" show="" value="ffffff7f7f">
Omi gravatar imageOmi ( 2025-08-26 18:36:56 +0000 )edit

Sorry. Work to be done in the documentation and terms used.
treeitem:set_text(text) - "Sets the text of the label."
treeitem.text - "Set/get the TreeItem's display string (string)."
These update the "Description" string as mentioned below.

WSUG: Table 6.3. The menu items of the “Packet Details” pop-up menu
Copy → Description - "Copy the displayed text of the selected field to the system clipboard."
Copy → Fieldname - "Copy the name of the selected field to the system clipboard."
Copy → Value - "Copy the value of the selected field to the system clipboard."

You would like to update the value of the field in the tree?

Chuckc gravatar imageChuckc ( 2025-08-27 19:05:13 +0000 )edit

Yes, the value of the group/struct copies as (null). I would like to change that value post dissection of the child fields. There does not seem to be a set_value()

Omi gravatar imageOmi ( 2025-08-27 22:05:15 +0000 )edit
Chuckc gravatar imageChuckc ( 2025-08-30 00:08:26 +0000 )edit