Skip to content

Conversation

@gucio321
Copy link
Collaborator

@gucio321 gucio321 commented Sep 2, 2021

hi there,
it may be useful to do just
giu.Label("this is some int: %d and string %s", 5, "string")
instead of using fmt.sprintf
giu.Label(fmt.Sprintf("this is some int: %d and string %s", 5, "string"))
or maybe I should add Labelf?

breaking: remove id argument from InvisibleButton(...)
@AllenDang
Copy link
Owner

  1. For 'Format' method, the format string is handled by c++, I don't suggest to format at first in go side.
  2. To add a new parameter named 'args' will confuse user, unless they read the document which we don't have, then more confuse. For this kind of operation, I suggest we keep them out of library, to keep the simplicity of API.

@gucio321
Copy link
Collaborator Author

gucio321 commented Sep 3, 2021

okey, @AllenDang what about

func Labelf(format, string, args ...interface{})*Label{
     return Label(fmt.Sprintf(fomrmat,args...)
}

it wouldn't be so confusing

@AllenDang
Copy link
Owner

okey, @AllenDang what about

func Labelf(format, string, args ...interface{})*Label{
     return Label(fmt.Sprintf(fomrmat,args...)
}

it wouldn't be so confusing

This would be good! :P

@gucio321
Copy link
Collaborator Author

gucio321 commented Sep 3, 2021

@AllenDang what about (*SliderInt).Formatf is it ok?

@AllenDang
Copy link
Owner

@gucio321 For existing 'Format' method, I need to refact them to use go's format instead. Let's add format to label first. After that I will follow your pattern to deal with 'Format'.

@gucio321
Copy link
Collaborator Author

gucio321 commented Sep 3, 2021

@AllenDang the PR is ready

@AllenDang AllenDang merged commit a990dfa into AllenDang:master Sep 3, 2021
@gucio321 gucio321 deleted the labelf branch September 3, 2021 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants