Notifications
Clear all

[Closed] Slider with multiple indicators?

I’m actually using a rollout instead of a form, will that have any impact?


EDIT: Okay, I got it.

with undo on (
	delete objects	
	ring = circle name:"LRing" radius:100 wireColor:(color 255 255 0) isSelected:on
	
	ca_test = attributes "ca" (
		parameters params rollout:RO (
		)
		
		rollout RO "RO" (
			dotNetControl	tb	"system.windows.forms.trackbar" height:21

			fn addRangeTrackbar =  (
				rtb = dotnetObject "DevExpress.XtraEditors.RangeTrackBarControl"
				rtb.Properties.Minimum = 0
				rtb.Properties.Maximum = 100
				rtb.Value = dotnetObject "DevExpress.XtraEditors.Repository.TrackBarRange" 0 100
				rtb.Dock = rtb.Dock.Top	
					
				tb.controls.add rtb

				dotNet.setLifetimeControl	rtb #dotnet
			)
			 on RO open do (
		   		executeTimer.tag = dotnetmxsvalue #(x, this)
				executeTimer.Start()
			)
		)
	)
		
	custAttributes.add ring ca_test
)

this trick was found specially for .net controls in rollouts. we are talking about mxs plugins and ca, aren’t we?

Yes we are. And one last question… any way to make a dotNet control’s settings “stick” in a rollout?

i.e. using the same above, I set the minimum and maximum slider values, click off the object and back on – I want to have the values stay what they were when I clicked off.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i don’t understand what you are trying to do

  1. I add my slider to the object, and drag the min/max indicators to particular values A and B.
  2. I click on some other scene object.
  3. I click back on the object with the slider, and I want the values to still be A and B.

I can set CA parameters and associate them with standard rollout controls so the values stay where I leave them after the rollout is closed. But how do I do this with .NET controls?

you have to add parameters to parameter block of your CA and bind them to .net control, but using event handlers instead of built-in mechanism.

in parameter block:

on min_value set val do updateDotNetRangeControl()
on max_value set val do updateDotNetRangeControl()

in rollout:

onValueEditiing do setParamBlockMinMaxValues()
on rollout open do updateDotNetRangeControl()

Hm, I wasn’t quite able to figure out how to set that up, but I did get it working with this. Are there any problems with the way I have it set up?

(
	ring = circle name:"Ring" radius:100 wireColor:(color 255 255 0) isSelected:on
	
	ca_test = attributes "ca" (
		parameters params rollout:RO (
			owner	type:#maxObject	
			v1 type:#float default:15
			v2 type:#float default:85
		)
		
		rollout RO "RO" (
			local owner
			
			dotNetControl	tb "system.windows.forms.trackbar" height:21
			label va ""

			fn getVal = ()--(va.text = owner.v1 as string + "," + owner.v2 as string)
			
			fn onEditValueChanging s a = (
				owner.v1 = a.NewValue.Minimum
				owner.v2 = a.NewValue.Maximum
				getVal()
			)	-- end fn onEditValueChanging
			
			fn addRangeTrackbar = (
				rtb = dotnetObject "DevExpress.XtraEditors.RangeTrackBarControl"
				rtb.Properties.Minimum = 0
				rtb.Properties.Maximum = 100
				rtb.Value = dotnetObject "DevExpress.XtraEditors.Repository.TrackBarRange" owner.v1 owner.v2
				rtb.Dock = rtb.Dock.Top	
					
				tb.controls.add rtb

				dotnet.addEventHandler		rtb #EditValueChanging onEditValueChanging
				dotNet.setLifetimeControl	rtb #dotnet
			)

			
			on RO open do (
				owner = (refs.dependentNodes (custAttributes.getOwner this))[1]
				executeTimer.tag = dotnetmxsvalue #(addRangeTrackbar, this)
				executeTimer.Start()
					
				getVal()
			)
		)
	)
		
	custAttributes.add ring ca_test
	ntm = nodeTransformMonitor node:ring forwardTransformChangeMsgs:false
	ring.owner = ntm
)

what you do doesn’t support undo/redo update when dialog opened

So how should I do it instead?

as i said above – use param block parameter handle:

on v set val do <update .net control>

I’m not getting it. Everything I am trying gives me an error or just does not work.

I don’t see a need for undoing changes to the slider bars anyway…

Page 3 / 4