How to increase length of Combo dropdown window #6130

Closed
opened 2023-01-30 20:21:45 +00:00 by mistahmikey · 7 comments
mistahmikey commented 2023-01-30 20:21:45 +00:00 (Migrated from github.com)

Is there a way to make the window length arbitrarily large?

Is there a way to make the window length arbitrarily large?
ocornut commented 2023-01-30 21:16:54 +00:00 (Migrated from github.com)

There are flags to BeginCombo() to configure the height to preset values, and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height.

There are flags to BeginCombo() to configure the height to preset values, and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height.
mistahmikey commented 2023-01-30 22:41:55 +00:00 (Migrated from github.com)

Thanks for the quick response.  Unfortunately, the SetNextWindowSize is not having any affect.  I  am using a lua binding, and my code looks roughly like this:

local dropdownSize = #items*GUI:GetFrameHeight()
GUI:SetNextWindowSize(0.0,dropdownSize,GUI.SetCond_Always)

if GUI:BeginCombo(label,selectedItem,flags) then
for i = 1,#items do
local item = tostring(items[i])
local isSelected = (item == selectedItem)
if GUI:Selectable(item,isSelected) then
if not isSelected then
newItem = item
changed = true
end
end
end
GUI:EndCombo()
end

I've verified the size is getting calculated correctly, but the combobox window remains at the default size. Let me know if I am misunderstanding this.

Thanks,

Mike
On 1/30/2023 4:17:06 PM, omar @.> wrote:
There are flags to BeginCombo() to configure the height to preset values, and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height.
—
Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1409352340], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJA5VCUK2BWDB4RFGW3WVAVVDANCNFSM6AAAAAAULS6AJY].
You are receiving this because you authored the thread.Message ID: @.
>

Thanks for the quick response.  Unfortunately, the SetNextWindowSize is not having any affect.  I  am using a lua binding, and my code looks roughly like this: local dropdownSize = #items*GUI:GetFrameHeight() GUI:SetNextWindowSize(0.0,dropdownSize,GUI.SetCond_Always) if GUI:BeginCombo(label,selectedItem,flags) then for i = 1,#items do local item = tostring(items[i]) local isSelected = (item == selectedItem) if GUI:Selectable(item,isSelected) then if not isSelected then newItem = item changed = true end end end GUI:EndCombo() end I've verified the size is getting calculated correctly, but the combobox window remains at the default size. Let me know if I am misunderstanding this. Thanks, Mike On 1/30/2023 4:17:06 PM, omar ***@***.***> wrote: There are flags to BeginCombo() to configure the height to preset values, and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height. — Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1409352340], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJA5VCUK2BWDB4RFGW3WVAVVDANCNFSM6AAAAAAULS6AJY]. You are receiving this because you authored the thread.Message ID: ***@***.***>
mistahmikey commented 2023-01-30 23:08:02 +00:00 (Migrated from github.com)

FYI, I am constrained to using version 1.63, if that matters.

FYI, I am constrained to using version 1.63, if that matters.
ocornut commented 2023-01-30 23:49:40 +00:00 (Migrated from github.com)

That explains why it doesn’t work. You can still use the flags to set policies assuming they were available in 1.63.

You should update because 1.63 is brutally ancient in Dear ImGui terms.

That explains why it doesn’t work. You can still use the flags to set policies assuming they were available in 1.63. You should update because 1.63 is brutally ancient in Dear ImGui terms.
mistahmikey commented 2023-01-30 23:54:43 +00:00 (Migrated from github.com)

Yeah, I think the flags are available.  And I can't upgrade, as much as I would like to - it's in an embedded product over which I have no control.  So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct?
On 1/30/2023 6:49:52 PM, omar @.> wrote:
That explains why it doesn’t work. You can still use the flags to set policies assuming they were available in 1.63.
You should update because 1.63 is brutally ancient in Dear ImGui terms.
—
Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1409533389], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJC4YUWWZVADTYZM4PTWVBHR7ANCNFSM6AAAAAAULS6AJY].
You are receiving this because you authored the thread.Message ID: @.
>

Yeah, I think the flags are available.  And I can't upgrade, as much as I would like to - it's in an embedded product over which I have no control.  So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct? On 1/30/2023 6:49:52 PM, omar ***@***.***> wrote: That explains why it doesn’t work. You can still use the flags to set policies assuming they were available in 1.63. You should update because 1.63 is brutally ancient in Dear ImGui terms. — Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1409533389], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJC4YUWWZVADTYZM4PTWVBHR7ANCNFSM6AAAAAAULS6AJY]. You are receiving this because you authored the thread.Message ID: ***@***.***>
ocornut commented 2023-01-31 10:25:20 +00:00 (Migrated from github.com)

So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct?

I don't know, I can't be looking at solving problems for a 4.5 years old version.
But the flags e.g. ImGuiComboFlags_HeightLargest are available since 1.53.

and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height.

FYI I was wrong here:
BeginCombo() supported SetNextWindowSizeConstraints() but not SetNextWindowSize(), until newly pushed f14288708.

> So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct? I don't know, I can't be looking at solving problems for a 4.5 years old version. But the flags e.g. `ImGuiComboFlags_HeightLargest` are available since 1.53. > and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height. FYI I was wrong here: BeginCombo() supported `SetNextWindowSizeConstraints()` but not `SetNextWindowSize()`, until newly pushed f14288708.
mistahmikey commented 2023-01-31 13:04:32 +00:00 (Migrated from github.com)

Yep, I understand.  Thanks for getting back to me anyway. You can close this one again.
On 1/31/2023 5:25:32 AM, omar @.> wrote:
So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct?
I don't know, I can't be looking at solving problems for a 4.5 years old version.
But the flags e.g. ImGuiComboFlags_HeightLargest are available since 1.53.
and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height.
FYI I was wrong here:
BeginCombo() supported SetNextWindowSizeConstraints() but not SetNextWindowSize(), until newly pushed f142887 [ocornut/imgui@f142887088].
—
Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1410107869], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJBQQ53TIN4OD4N6VLLWVDSBXANCNFSM6AAAAAAULS6AJY].
You are receiving this because you authored the thread.Message ID: @.
>

Yep, I understand.  Thanks for getting back to me anyway. You can close this one again. On 1/31/2023 5:25:32 AM, omar ***@***.***> wrote: So just to be clear - in v1.63, there is no way to make the dropdown as long as the number of items it contains (beyond what the flags allow, at least), correct? I don't know, I can't be looking at solving problems for a 4.5 years old version. But the flags e.g. ImGuiComboFlags_HeightLargest are available since 1.53. and you can also call SetNextWindowSize() prior to BeginCombo() to set an explicit height. FYI I was wrong here: BeginCombo() supported SetNextWindowSizeConstraints() but not SetNextWindowSize(), until newly pushed f142887 [https://github.com/ocornut/imgui/commit/f142887088c9e94f17aa5a5b263b30add5d6a10a]. — Reply to this email directly, view it on GitHub [https://github.com/ocornut/imgui/issues/6130#issuecomment-1410107869], or unsubscribe [https://github.com/notifications/unsubscribe-auth/ACCGWJBQQ53TIN4OD4N6VLLWVDSBXANCNFSM6AAAAAAULS6AJY]. You are receiving this because you authored the thread.Message ID: ***@***.***>
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#6130
No description provided.