Notifications
Clear all
[Closed] MAXScript dropdownlist "width when dropped-down" to accommodate items' width?
Dec 30, 2015 7:55 am
Hi,
DropDownWidth property does not report an error, but it also does not work nor in the document.
But I still think it is possible, because “width when dropped-down” adapts to items property on dropdownlist creation, but adding more items won’t adapt “width when dropped-down”.
Thoughts?
Thanks!
2 Replies
Dec 30, 2015 7:55 am
dropdownlist doesn’t automatically adjust its dropped list width to content.
but you can change it after creation using CB_SETDROPPEDWIDTH message:
try(destroydialog dialog) catch()
rollout dialog "DropDown Resize" width:200
(
local CB_GETDROPPEDWIDTH = 351
local CB_SETDROPPEDWIDTH = 352
dropdownlist resized_dd width:180 align:#right offset:[4,0]
button resize_bt "Resize" width:180 align:#right offset:[4,0]
on resize_bt pressed do
(
w = windows.sendmessage resized_dd.hwnd[1] CB_GETDROPPEDWIDTH 0 0
windows.sendmessage resized_dd.hwnd[1] CB_SETDROPPEDWIDTH (w+10) 0
w = windows.sendmessage resized_dd.hwnd[1] CB_GETDROPPEDWIDTH 0 0
format ">> %
" w
)
on resize_bt rightclick do
(
w = windows.sendmessage resized_dd.hwnd[1] CB_GETDROPPEDWIDTH 0 0
windows.sendmessage resized_dd.hwnd[1] CB_SETDROPPEDWIDTH (w-10) 0
w = windows.sendmessage resized_dd.hwnd[1] CB_GETDROPPEDWIDTH 0 0
format "<< %
" w
)
)
createdialog dialog
i hope that would not be a big deal to get new minimum size if you know font size and text of items