Notifications
Clear all

[Closed] Subrollout update one more time

I saw this thread.
Denis’s C# magic worked. But, now the entire dialog is flashing when redraw.
I was trying to turn off updating only from subrollout. Failed.

Other solution?

12 Replies
 MZ1

You should show some example …

The link has examples.

4 Replies
(@polytools3d)
Joined: 10 months ago

Posts: 0

The script from Klunk works without flickering on my end if I just remove the off-screen part from it (2014+).

(@denist)
Joined: 10 months ago

Posts: 0

it depends on Windows system and Display drivers sometimes.

(@polytools3d)
Joined: 10 months ago

Posts: 0

Yes, I guess it does. Unfortunately I have no way to recreate the “flickering” behavior.

(@denist)
Joined: 10 months ago

Posts: 0

i see the flickering sometimes… inside subrollout panel. it’s an interesting issue. i would like to review the solution.

it’s easy to reproduce. make some sub rollouts list longer. for example:

  	rollout testTabsRollout01 "Rollout 01"
  	(
  		spinner spn_spinner "Spinner" offset:[0,70]
  	)
  	rollout testTabsRollout02 "Rollout 02"
  	(
  		button btn_button "Button" offset:[0,70]
  	)
  	rollout testTabsRollout03 "Rollout 03"
  	(
  		label lbl_label "This is some text"
  	)
  	rollout testTabsRollout04 "Rollout 04"
  	(
  		colorpicker clr_picker "Color Picker"
  	)
  	rollout testTabsRollout05 "Rollout 05"
  	(
  		checkbox chk_box "Checkbox"
  	)
  	
  	testTabs_Rollouts = #(
  		#("Tab One",#(testTabsRollout01)),
  		#("Tab Two",#(testTabsRollout02, testTabsRollout01, testTabsRollout03)),
  		#("Tab Three",#(testTabsRollout03)),
  		#("Tab Four",#(testTabsRollout04,testTabsRollout05))
  	)

if we do disable/enable/redraw for theSubRollout it fixes the issue. unfortunately there is no better solution because all about sub-rollout mechanism is a black box in max api

Yes, adding more controls and tabs shows some flickering.

This seems to fix it for me, which is basically the same but without the need of C#.

(
  	rollout ro01 "Rollout 01"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro01 open do for j in ro01.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro02 "Rollout 02"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro02 open do for j in ro02.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro03 "Rollout 03"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro03 open do for j in ro03.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro04 "Rollout 04"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro04 open do for j in ro04.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro05 "Rollout 05"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro05 open do for j in ro05.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro06 "Rollout 06"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro06 open do for j in ro06.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro07 "Rollout 07"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro07 open do for j in ro07.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro08 "Rollout 08"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro08 open do for j in ro08.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro09 "Rollout 09"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro09 open do for j in ro09.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	rollout ro10 "Rollout 10"
  	(
  		button bt01 "B1" width:32 height:32 pos:[  8,8]
		button bt02 "B2" width:32 height:32 pos:[ 40,8]
		button bt03 "B3" width:32 height:32 pos:[ 72,8]
		button bt04 "B4" width:32 height:32 pos:[104,8]
		button bt05 "B5" width:32 height:32 pos:[136,8]
		button bt06 "B6" width:32 height:32 pos:[168,8]
		button bt07 "B7" width:32 height:32 pos:[200,8]
		button bt08 "B8" width:32 height:32 pos:[232,8]
		button bt09 "B9" width:32 height:32 pos:[264,8]
		button bt10 "B0" width:32 height:32 pos:[296,8]
		
		on ro10 open do for j in ro10.controls do j.text = "B" + ((random 1 99) as string)
  	)
  	
  	tabs = #(
  		#("Tab One"  ,#(ro01, ro02, ro03, ro04, ro05, ro06, ro07, ro08, ro09, ro10)),
  		#("Tab Two"  ,#(ro02, ro01, ro03, ro04, ro05, ro06, ro07, ro08, ro09, ro10)),
  		#("Tab Three",#(ro03, ro02, ro01, ro04, ro05, ro06, ro07, ro08, ro09, ro10)),
  		#("Tab Four" ,#(ro04, ro03, ro02, ro01, ro05, ro06, ro07, ro08, ro09, ro10))
  	)
  	
	try destroyDialog ::RO_TABS_TEST catch()
	
  	rollout RO_TABS_TEST "Test Tabs"
  	(
		dotNetControl dn_tabs       "TabControl" width:348 height:20  align:#center
		subRollout    theSubRollout ""           width:348 height:706 align:#center
		
		checkbox      chk_redraw    "Disable Redraw" pos:[8,748] checked:true
		
		local lastIdx = 1
		local WM_SETREDRAW = 0xB
		local redrawDisabled = true
		
		on dn_tabs Selected itm do
		(
			if lastIdx != (itm.TabPageIndex+1) do
			(
				if redrawDisabled do windows.sendMessage theSubRollout.hwnd[1] WM_SETREDRAW 0 0
				
				for subroll in tabs[lastIdx][2] do removeSubRollout theSubRollout subroll
				for subroll in tabs[lastIdx = itm.TabPageIndex+1][2] do addSubRollout theSubRollout subroll
				
				if redrawDisabled do
				(
					windows.sendMessage theSubRollout.hwnd[1] WM_SETREDRAW 1 0
					RO_TABS_TEST.theSubRollout.pos = RO_TABS_TEST.theSubRollout.pos
				)
			)
		)
		
		on RO_TABS_TEST open do
		(
			for j in tabs do dn_tabs.TabPages.add j[1]
			for j in tabs[1][2] do addSubRollout theSubRollout j
		)
		
		on chk_redraw changed arg do redrawDisabled = arg
  	)
  
  	createDialog RO_TABS_TEST 360 780
	
)

Yea, I should have created the rollouts dynamically.

Can’t reproduce any flickering (Max 2016).

Do you notice any difference If you check/uncheck the “Disable Redraw” checkbox?

1 Reply
(@aaandres)
Joined: 10 months ago

Posts: 0

Not at all. Perhaps it’s my view. I’m getting older… every year!

Using windows.sendMessage as neat.
For my case, every time I have different numbers of rollouts.
At the end I had to nudge subrolllout pos and back.

It is far better now,
I still see one flash when subrollout is redrawn.
But, it is far better than raining down rollouts.