Comments (3)
I started looking at this today, but have so far not really figured out what goes wrong while refreshing the list.
from gooey.
No worries, thanks for taking a look though! I was able to resolve this issue by trimming down the refresh function by moving the gui node deletion and creation steps out. Instead, this occurs during initialization an the new nodes are 'reparented' on refresh using gui.set_parent(node, e.nodes[hash("dynamic_list_item")])
The only caveat with this method is that I had to manually set the item index. Otherwise, you will not be able to select a list item with scrolling first.
Still not sure why the previous behavior occurs, unfortunately
from gooey.
I'm not sure what you are doing wrong as the example you've included is relatively complicated to follow. But let's instead start by looking at the horizontal list example provided here in this repository:
https://github.com/britzl/gooey/blob/master/example/horizontallist.gui_script#L75-L77
Open that example and modify the list click behaviour to remove the item that is clicked:
local list = gooey.horizontal_dynamic_list("dynamiclist_bg", "dynamiclist_stencil", "listitem_bg", self.list_data, action_id, action, nil, function(list)
print("selected dynamic list item", list.selected_item.index, list.data[list.selected_item.index].text)
local v = table.remove(list.data, list.selected_item.index)
print("removed", v.text)
gooey.horizontal_dynamic_list("dynamiclist_bg", "dynamiclist_stencil", "listitem_bg", self.list_data, nil, nil, nil, nil, refresh_dynamiclist)
end, refresh_dynamiclist)
What we do here is to remove the item from the list.data
and then we call the gooey.horizontal_dynamic_list()
function again to make sure the internal list state is updated and the visuals refreshed. Try the example with the modification above and then click on items in the list to remove them. Notice that the list is refreshing properly.
from gooey.
Related Issues (20)
- Trying to erase none utf8 characters throw errors HOT 4
- Input state machine doesn't include 'released_now' or 'clickable' fields on last frame HOT 13
- Scroll list flick
- Bug: If dynamic list becomes empty, items have invalid data attached HOT 3
- Using character . after numbers will introduces extra characters on mobile HOT 6
- Missing return checkbox instance in set_checked or set_visible HOT 1
- Scrolling wheel speed option
- How can I change the theme ? HOT 2
- No typing input from Android browsers HOT 2
- Missed backspaces on iOS
- Grid component
- .nodes failing on list items in dynamic_list HOT 3
- Input widget's "deselected_now" property always false
- List data HOT 1
- Lists are not updated on list refresh since 10.0.0 HOT 2
- Fix for trailing spaces creates issues
- Example project missing sprites and runtime errors HOT 4
- Radio parameter description missing
- Feature request: UI navigation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gooey.