Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ItemList - set_item_disabled() doesnt have any visible effect #5683

Closed
blurymind opened this issue Jul 14, 2016 · 11 comments
Closed

ItemList - set_item_disabled() doesnt have any visible effect #5683

blurymind opened this issue Jul 14, 2016 · 11 comments
Milestone

Comments

@blurymind
Copy link

blurymind commented Jul 14, 2016

Bugsquad edit: Seen in 2.1-beta (but actually there too in 2.0)

It doesnt seem to do what it is supposed to.

Try it

func _on_ItemList_item_selected( index ):
    set_item_disabled(index,true)

or am i messing something up here? :)

@akien-mga
Copy link
Member

It seems to work fine for me to toggle the disabled parameter:

func _ready():
    add_item("Toto 1")
    add_item("Toto 2")
    add_item("Toto 3")

func _on_item_selected( index ):
    print("idx:", str(index), " - disabled: " + str(is_item_disabled(index)))
    set_item_disabled(index, true)
    print("idx:", str(index), " - disabled: " + str(is_item_disabled(index)))

Now the question is more, what should the disabled status do?

@akien-mga akien-mga changed the title Godot 2.1 beta - itemList - set_item_disabled() doesnt work ItemList - set_item_disabled() doesnt have any visible effect Jul 14, 2016
@akien-mga akien-mga added this to the 2.1 milestone Jul 14, 2016
@akien-mga
Copy link
Member

Now the question is more, what should the disabled status do?

Looking at the source code, it doesn't do anything. It's just something that you can set with set_item_disabled and get with is_item_disabled. So you can use it in your game's logic by checking first if is_item_disabled before doing stuff with the item.

I don't know what was the intended use of this parameter though. @reduz, you added it one year ago when refactoring the file dialog: https://github.com/godotengine/godot/blame/2fd9b77/scene/gui/item_list.cpp#L1278-L1279
Do you remember what you wanted it to be used for?

@blurymind
Copy link
Author

According to godot's online documentation it should make the item
unclickable when disabled.

That is also what i wanted it to do.
How does one do that anyways?

On 14 Jul 2016 06:45, "Rémi Verschelde" [email protected] wrote:

It seems to work fine for me to toggle the disabled parameter:

func _ready():
add_item("Toto 1")
add_item("Toto 2")
add_item("Toto 3")

func _on_item_selected( index ):
print("idx:", str(index), " - disabled: " + str(is_item_disabled(index)))
set_item_disabled(index, true)
print("idx:", str(index), " - disabled: " + str(is_item_disabled(index)))

Now the question is more, what should the disabled status do?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#5683 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AGMbVSrGR2HS9t8n2-wv4nAGqdY1G0DAks5qVczbgaJpZM4JL_mN
.

@akien-mga
Copy link
Member

According to godot's online documentation it should make the item
unclickable when disabled.

What part of the documentation? It's not said in the class reference, where it is undocumented.

@akien-mga
Copy link
Member

How does one do that anyways?

void set_item_selectable ( int idx, bool selectable )

@blurymind
Copy link
Author

blurymind commented Jul 14, 2016

@akien-mga I made a mistake. I was looking at the popup menu's documentation here:
http://docs.godotengine.org/en/latest/classes/class_popupmenu.html#class-popupmenu-set-item-disabled

it has the same set_item_disabled method. It does the following:

Sets whether the item at index “idx” is disabled or not. When it is disabled it can’t be selected, or its action invoked.

Basically that is what I want - I want the item to not be invoked when clicked and also disabled visually.

void set_item_selectable ( int idx, bool selectable )
Doesnt seem to do anything either

@blurymind
Copy link
Author

blurymind commented Jul 14, 2016

I understand now - I just need to add an extra if case to make it work. But how do I grey out the item?
With another method right?

@blurymind
Copy link
Author

sorry if that is the intended design - I will close this issue.

@akien-mga
Copy link
Member

That's not the intended design, see my above comment: #5683 (comment)

@blurymind
Copy link
Author

ah I see. Thank you for looking into this and also providing a temporary workaround. If they store a disabled state - then I can check the state with an ifcase before triggering the events that are in the signal.

@reduz reduz closed this as completed in 93c3c80 Jul 21, 2016
@blurymind
Copy link
Author

@reduz thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants