horizontal scrollbar ImGui

Started by stakov999, March 20, 2018, 12:29:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Dear all,

I'm currently meeting a problem with Imgui.
To explain shortly : i'm drawing an array (like an Excel array) with something like :

for line=1,10 do
  for col=1,10 do

With that method, if the array is horizontally larger than the current window, the buttons are automatically resized so that they fit in the window.
Which is weird because if it's bigger than the vertical size of the window, then it calls the scrollbar to go up/down.
I'd like to call a scrollbar like this, but horizontally. Do you think it would be possible with any GeexLab function ?

Thanking you in advance



Yes it's weird indeed. Vertical and horizontal scrollbars are enabled. I will look at ImGui functions, maybe it's a bug in GeeXLab. I let you know.


I found the way to enable horizontal scrollbar. Just define a new constant window_horizontal_scrollbar with value 2048 and use it in window flags:

local pos_size_flag_always = 1
local window_no_save_settings = 256
local window_horizontal_scrollbar = 2048

local window_flags = window_no_save_settings | window_horizontal_scrollbar

local is_open = gh_imgui.window_begin("myWindow", 200, 400, 0, 0, window_flags, pos_size_flag_always, pos_size_flag_always)

By default, the vertical scrollbar is enabled and the horizontal scrollbar is disabled.


It's now working, thank you !
There were two reasons of the issue : one you solved with allowing horizontal scrollbar, and the other one is that gh_imgui.columns automatically resizes the columns so they fit in the window.
I builded my own column array with a simple loop and "same line" statement.