{"action":"created","issue":{"url":"https://api.github.com/repos/ocornut/imgui/issues/513","labels_url":"https://api.github.com/repos/ocornut/imgui/issues/513/labels{/name}","comments_url":"https://api.github.com/repos/ocornut/imgui/issues/513/comments","events_url":"https://api.github.com/repos/ocornut/imgui/issues/513/events","html_url":"https://github.com/ocornut/imgui/issues/513","id":129699756,"number":513,"title":"Column headers","user":{"login":"itamago","id":16628136,"avatar_url":"https://avatars.githubusercontent.com/u/16628136?v=3","gravatar_id":"","url":"https://api.github.com/users/itamago","html_url":"https://github.com/itamago","followers_url":"https://api.github.com/users/itamago/followers","following_url":"https://api.github.com/users/itamago/following{/other_user}","gists_url":"https://api.github.com/users/itamago/gists{/gist_id}","starred_url":"https://api.github.com/users/itamago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamago/subscriptions","organizations_url":"https://api.github.com/users/itamago/orgs","repos_url":"https://api.github.com/users/itamago/repos","events_url":"https://api.github.com/users/itamago/events{/privacy}","received_events_url":"https://api.github.com/users/itamago/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2016-01-29T08:21:57Z","updated_at":"2016-01-31T10:20:36Z","closed_at":null,"body":"Hello,\r\n\r\nIn case you are creating *tables* with lot of columns, here is a short code snippet to quickly manage the column headers :\r\n\r\n\tstruct ColumnHeader\r\n\t{\r\n\t\tconst char* label;\r\n\t\tfloat size;\r\n\t};\r\n\r\n\tColumnHeader headers[] =\r\n\t\t{\r\n\t\t\t{ \"Idx\", 50 },\r\n\t\t\t{ \"Name\", 500 },\r\n\t\t\t{ \"RT\", 50 },\r\n\t\t\t{ \"Depth\", 50 },\r\n\t\t\t{ \"Full\", 50 },\r\n\t\t\t{ \"ClearColor\", 50 },\r\n\t\t\t{ \"Width\", 250 },\r\n\t\t\t{ \"Height\", 250 },\r\n\t\t\t{ \"Filter\", 250 },\r\n\t\t\t{ \"WrapU\", 250 },\r\n\t\t\t{ \"WrapV\", 250 },\r\n\t\t\t{ \"Flip\", 50 },\r\n\t\t\t{ \"Filename\", 450 }\r\n\t\t};\r\n\r\n\tImGui::Columns(IM_ARRAYSIZE(headers), \"TableTextureColumns\", true);\r\n\tImGui::Separator();\r\n\tfloat offset = 0.0f;\r\n\tfor(ColumnHeader & header : headers)\r\n\t{\r\n\t\tImGui::Text(header.label);\r\n\t\tImGui::SetColumnOffset(-1, offset);\r\n\t\toffset += header.size;\r\n\t\tImGui::NextColumn();\r\n\t}\r\n\tImGui::Separator();\r\n\r\n\t// and then iterate over the rows of your table...\r\n\r\nI'm wondering if there is a simple way to make the headers \"fixed\", like in Excel when the top row is fixed ?\r\nBecause you obviously want to see the headers while scrolling in your table.\r\n\r\nThx"},"comment":{"url":"https://api.github.com/repos/ocornut/imgui/issues/comments/177457128","html_url":"https://github.com/ocornut/imgui/issues/513#issuecomment-177457128","issue_url":"https://api.github.com/repos/ocornut/imgui/issues/513","id":177457128,"user":{"login":"itamago","id":16628136,"avatar_url":"https://avatars.githubusercontent.com/u/16628136?v=3","gravatar_id":"","url":"https://api.github.com/users/itamago","html_url":"https://github.com/itamago","followers_url":"https://api.github.com/users/itamago/followers","following_url":"https://api.github.com/users/itamago/following{/other_user}","gists_url":"https://api.github.com/users/itamago/gists{/gist_id}","starred_url":"https://api.github.com/users/itamago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itamago/subscriptions","organizations_url":"https://api.github.com/users/itamago/orgs","repos_url":"https://api.github.com/users/itamago/repos","events_url":"https://api.github.com/users/itamago/events{/privacy}","received_events_url":"https://api.github.com/users/itamago/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T10:20:36Z","updated_at":"2016-01-31T10:20:36Z","body":"I did a test by reducing from 13 columns to only 4. The widgets were the same, and I kept row-clipping disabled in order to maximise the number of vertices. \r\n\r\nThe gain is negligible :\r\n  - 13 columns => 65920 vertices  /  237117 indices  /  79039 triangles\r\n  -   4 columns => 64676 vertices  /  235191 indices  /  78397 triangles\r\n \r\nIt means that Columns have a very low overhead, that's great :)"}}