dontpanic92 / wxGo

Golang wxWidgets Wrapper
Other
403 stars 51 forks source link

Objects in Choices #63

Closed undeadindustries closed 6 years ago

undeadindustries commented 6 years ago

If saving an object into a Choice, how would one get that object back?

This wx python way does not seem to work in wx go?

https://stackoverflow.com/questions/4433715/how-can-i-store-objects-other-than-strings-in-a-wxpython-combobox

Choice := wx.NewChoice(panel, wx.ID_ANY)
Choice.SetLabel("Choose an option")
Choice.Append(obj)
Choice.SetString(theChoice, obj.Name)

obj := Choice.GetClientObject()

Thanks!

dontpanic92 commented 6 years ago

I'm afraid you have to maintain the objects in your own map - i.e. string/ControlID as the key, and your object as the value.