Button label alignment #842

Closed
opened 2016-09-23 15:01:52 +00:00 by BLK-Dragon · 4 comments
BLK-Dragon commented 2016-09-23 15:01:52 +00:00 (Migrated from github.com)

Is it possible to have button label left-aligned?
(when button-size is explicitly set larger than text, text is always centered)

Is it possible to have button label left-aligned? (when button-size is explicitly set larger than text, text is always centered)
ocornut commented 2016-09-23 15:04:28 +00:00 (Migrated from github.com)

Not currently possible, but it shouldn't be too hard to add the option in Style.

Not currently possible, but it shouldn't be too hard to add the option in Style.
BLK-Dragon commented 2016-09-23 15:11:20 +00:00 (Migrated from github.com)

Indeed, judging from ImGui::ButtonEx() code.
Probably, it should be a button-flag.

Indeed, judging from ImGui::ButtonEx() code. Probably, it should be a button-flag.
ocornut commented 2016-09-25 08:51:05 +00:00 (Migrated from github.com)

Note that it would be left-aligned but still will FramePadding applied, so not touching the border.

Note that it would be left-aligned but still will FramePadding applied, so not touching the border.
ocornut commented 2016-09-25 11:04:26 +00:00 (Migrated from github.com)

Done. I took the occasion to clean up a few related things I wanted to change.
You can adjust style.ButtonTextAlign or use PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ...)
ImVec2(0.5f,0.5f) = centered (default for buttons)

Done. I took the occasion to clean up a few related things I wanted to change. You can adjust style.ButtonTextAlign or use PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ...) `ImVec2(0.5f,0.5f)` = centered (default for buttons)
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#842
No description provided.