[solved] Listbox and data added programmatically - Forum

Forum Navigation
You need to log in to create posts and topics.

[solved] Listbox and data added programmatically

Hello,
Please, does it exist an event or a command which could let us know when an object is ready to be touched after having been filled ?

In the example attached, after having populated a Listbox, I have tried to select an entry. So, I have tried to make a Refresh and finished by a Wait with an arbitrary delay. Is this the correct way of doing things ? Many thanks

Spoiler

ListBoxSize "Listbox2" [i]
Loop 1 [i] [li]
ListBoxDeleteItem "Listbox2" 1
endloop

ListBoxAddItem "Listbox2" "A" ""
ListBoxAddItem "Listbox2" "B" ""
ListBoxAddItem "Listbox2" "C" ""

.refresh
Wait 100
BeginJS
  $("#Listbox2 option").filter(function() {
    return $(this).text() == "B";
  }).prop('selected', true);
EndJS
ListBoxGetSelectedIndex "Listbox2" [r2]
ConsoleLog "Initial item selected: [r2]"
EndWait



ListBoxGetSelectedIndex "Listbox2" [rl]
ConsoleLog "Initial item selected: [rl]"

 

Uploaded files:
  • You need to login to have access to uploads.

Not sure but, as you are using both NeoScript and JavaScript I think right now it's the correct way.
In JQuery it's possible to use "when" to execute code after a given asyncronous code have finished:
https://api.jquery.com/jQuery.when/

Regards.

Samuel Vanneste has reacted to this post.
Samuel Vanneste