![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Freeman |
I am trying to use an ItemList to create a clickable text menu. I could not find any tutorial on the subject, nor easy and clear explanation, so I really expected it to be as simple a using a list of buttons, but I think I was wrong.
My ItemList
has two items: item01
and item02
and was set to send an item_selected(index int)
signal
I am trying to get at least a print command working after item01
or item02
gets selected.
So far I tried things similar to:
func _on_ItemList_item_selected(index):
if $ItemList.is_selected(1) = true:
print("Item 01 selected")
but nothing works.
So, I have two questions.
- How to detect that
item01
is selected/clicked in
func _on_ItemList_item_selected(index)
:? - Why is it so different from the idea of button pressing detection etc. (at least it looks like that at first)?
Your example code has a missing =
in the condition. It has if value1 = value2
instead of if value1 == value2
Rodrigo Matos | 2020-04-03 17:32
Thanks Rodrigo Matos. You are right. That was the problem!
Freeman | 2020-04-03 17:41