Skip to content
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

Clicking on an InputFloat gives focus to InputText as well? #480

Closed
vexe opened this issue Jan 11, 2016 · 4 comments
Closed

Clicking on an InputFloat gives focus to InputText as well? #480

vexe opened this issue Jan 11, 2016 · 4 comments
Labels
label/id and id stack implicit identifiers, pushid(), id stack

Comments

@vexe
Copy link

vexe commented Jan 11, 2016

Greetings!

I'm having a weird situation where I have an InputFloat and an InputText, if I give focus to the InputFloat, the InputText field gets focus too with the same value as in the InputFloat field!

Video demonstrating the issue and showing the code I'm using: https://youtu.be/DLK8VKl5IA0

Why is this happening? Pretty sure I'm missing something obvious...

Thanks
-vexe

EDIT: Interestingly, it's only the scale field that's buggy, the InputFloat3 for the position is working fine, (doesn't give focus to InputText)

@vexe
Copy link
Author

vexe commented Jan 11, 2016

Beginner mistake since I'm new to your framework. It seems that you're using the 'label' that gets passed to InputXXX as a hash value? Giving InputText a value for its label the issue is no longer. It would be nice if the label was positioned to the left instead of the right. There's probably a way to do that just have to dig in.

@vexe vexe closed this as completed Jan 11, 2016
@vexe
Copy link
Author

vexe commented Jan 11, 2016

Is there anyway to give custom values to the hashes (different than the label)? For example, I have a ImGui::Text with value "Reset" and 3 buttons beside it on the same line "Position", "Rotation" and "Scale" (they reset the position, rotation or scale of the selected object etc)

And then at the bottom, I have an InputFloat with label "Scale" - now I have two controls with the same label (thus the same hash?), the "Scale" Button and InputFloat. If I give focus to the InputFloat, it unfocuses immediately. Unless I give them different labels e.g. "Reset Scale" and "Scale"

@nem0
Copy link
Contributor

nem0 commented Jan 11, 2016

From docs:

 When passing a label you can optionally specify extra unique ID information within string itself. This helps solving the simpler collision cases.
     use "##" to pass a complement to the ID that won't be visible to the end-user:
       Button("Play");         // Label = "Play",   ID = hash of "Play"
       Button("Play##foo1");   // Label = "Play",   ID = hash of "Play##foo1" (different from above)
       Button("Play##foo2");   // Label = "Play",   ID = hash of "Play##foo2" (different from above)

@ocornut
Copy link
Owner

ocornut commented Jan 11, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
label/id and id stack implicit identifiers, pushid(), id stack
Projects
None yet
Development

No branches or pull requests

3 participants