[Closed] Overriding messages in the Prompt Line
I’ve been wondering if I could replace having a progressbar in my script GUI’s with just outputting the progress in the Prompt Line instead. I’m currently using displayTempPrompt to output the progress:
displayTempPrompt ("Progress: " + currentProgress) 10000
However, certain script operations overrides my message to the Prompt Line (example: when merging in multiple max-files):
Is there any way to “freeze” the Prompt Line (similar to the way disableSceneRedraw() works in the viewport)? If there is, then I could replace all of the progressbars in my script with messages to the Prompt Line instead, but that’s only applicable if it’s possible to prevent Max from overriding my own messages to the Prompt Line. Is this possible?
you could perhaps add a timer that would check if the correct message is shown at the moment and update it to the previous state if it was changed by max,
another thing to try is this:
If it’s possible to retrieve the current message in the prompt line that could work, but is that possible? I haven’t found an option to query the current prompt message in the MaxScript Reference (on Prompt Line)?
This didn’t seem to affect the the prompt line messages
Actually, if you use parent control handle and use WM_SETREDRAW as in suggested thread it will block redraws until you enable it back. It has some drawbacks though as if the status panel could be partially hidden behind some window and with disabled redraws content that you would expect to be visible won’t be drawn
try (destroydialog X ) catch ()
rollout X "" (
button b "press"
checkbutton enable_redraw "enable redraw" checked:false
fn GetStatusPanelTextHwnd =
(
local g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
local tb = (windows.getchildhwnd g.coreinterface14.StatusPanelHWND "StatusPanelBottomContainer")
for w in windows.getchildrenhwnd tb[1] where w[4] == "CustStatus" do return w[1]
)
local msg = "here's the message"
local hwnd = GetStatusPanelTextHwnd()
local parent_hwnd = UIAccessor.GetParentWindow hwnd
fn SetRedrawEnabled hwnd state =
(
local WM_REDRAW = 11
windows.sendMessage hwnd WM_REDRAW (if state then 1 else 0) 0
)
on x open do
(
DisplayTempPrompt msg 5000
SetRedrawEnabled parent_hwnd enable_redraw.checked
)
on enable_redraw changed state do
(
SetRedrawEnabled parent_hwnd enable_redraw.checked
)
on b pressed do
(
pushPrompt ((random 123465 789456) as string)
)
on x close do
(
SetRedrawEnabled parent_hwnd true
replacePrompt ""
)
)
createDialog X pos:[100,100]
try UIAccessor.GetWindowText <HWND>hwnd
where hwnd is the handle of the control with text
dont know if that will work in qt versions of max
try (destroydialog X ) catch ()
rollout X "" (
button b "press"
timer t interval:50 active:false
fn GetStatusPanelTextHwnd =
(
local g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
local tb = (windows.getchildhwnd g.coreinterface14.StatusPanelHWND "StatusPanelBottomContainer")
for w in windows.getchildrenhwnd tb[1] where w[4] == "CustStatus" do return w[1]
)
local msg = "here's the message"
local hwnd = GetStatusPanelTextHwnd()
on t tick do
(
if (UIAccessor.GetWindowText hwnd) != msg do replacePrompt msg
)
on x open do
(
DisplayTempPrompt msg 5000
)
on b pressed do
(
-- now starting the timer...
t.active = true
pushPrompt "abc 42"
)
on x close do
(
replacePrompt ""
)
)
createDialog X pos:[100,100]
No maxscript challenge seems impossible when asking on here, this worked perfectly Serejah. Thank you!