-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
add GenAutoID to Context #795
Conversation
@gucio321 To stabilize the ID of a widget, you only need to invoke .ID(xxx) on the widget which you don't need the auto-generation. |
@gucio321 To globally disable the GenAutoID is not necessary. |
Hi @AllenDang giu.Button("").ID("my id##id")
// vs
giu.Context.GenAutoID = func(id string) string {return id}
giu.Button("my id##id") the above when using more widgets seems easier and more logical in use. And whay would I want to disable audo id? but there is another use case for the feature from this PR. Users can define their own GenAutoID methods (idk why would they want to do this but, it is possible now just in case). Also, use of this feature is optional so if someone doesn't need it or doesn't even know abuot it nothing happens. |
@gucio321 |
yes and no. In my opinion it will be really confusing.
func GenAutoID(id string, widgetType WidgetType) ID {}
type WidgetType byte
const(
// types for all widgets
)
type Context struct {
// ...
widgetCounter map[WidgetType]int
} in this secenerio, each widget type will have separated counter and e.g. buttons will not affect tab bar
|
@gucio321 the 3rd solution is good! |
ok, I'll add this as I get some time. |
@gucio321 I my opinion, I'd like to keep GenAutoID stuff behind the scene, user doesn't need to know it, so I suggest to revert. |
ok, done Also, I think I can add some parts of the 2nd method especially, I think that highlighting when a string is |
@gucio321 Agree, sounds good. |
this allows to disable GenAutoID