Notifications
Clear all

[Closed] Slider with multiple indicators?

you probably have infinite ‘change call’ – .net control changes params <-> params change .net control and so on.

you have to update value if they are different

Hi Malkalypse.

I have played a little with your code.
Here’s a version where:

  • You don’t need ‘owner’ as parameter (nor nodemonitor)
  • Values v1 and v2 can be changed by other script (or listener) and these changes affect the controlBar range values.
  • You avoid problems with other CA that may have parameters with the same names v1 and v2

	global executeTimer = 
	(
		timer = dotnetobject "Timer"
		timer.interval = 10
		fn executeJob s e = 
		(
			s.Stop()
			s.tag.value[1] data:s.tag.value[2]
		)
		dotnet.addEventHandler timer "Tick" executeJob
		timer
	)


	(
		ring = circle name:"Ring" radius:100 wireColor:(color 255 255 0) isSelected:on
		
		ca_test = attributes "ca"
		(

			fn updateDotNetRangeControl trackBarRangeControl =
			(
				trackBarRangeControl.Value = dotnetObject "DevExpress.XtraEditors.Repository.TrackBarRange" this.v1 this.v2
			)
			
			
			parameters params rollout:RO
			(
				v1 type:#float default:15
				v2 type:#float default:85
				
				on v1 set val do
				(
					trackBarRangeControl = this.RO.rtb
					if trackBarRangeControl != undefined do updateDotNetRangeControl trackBarRangeControl
				)
				
				on v2 set val do
				(
					trackBarRangeControl = this.RO.rtb
					if trackBarRangeControl != undefined do updateDotNetRangeControl trackBarRangeControl
				)
				
			)
			
			
			
			
			rollout RO "RO"
			(
				local owner
				local rtb
				
				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 create_rtb =
				(
					rtb = dotnetObject "DevExpress.XtraEditors.RangeTrackBarControl"
					rtb.Properties.Minimum = 0
					rtb.Properties.Maximum = 100
					rtb.Dock = rtb.Dock.Top	
					rtb
				)

				fn addRangeTrackbar =
				(
					tb.controls.add rtb
					dotnet.addEventHandler	rtb #EditValueChanging onEditValueChanging
					dotNet.setLifetimeControl	rtb #dotnet
				)
				
				
				on RO open do
				(
					owner = this
					rtb = create_rtb()
					updateDotNetRangeControl rtb
						
					executeTimer.tag = dotnetmxsvalue #(addRangeTrackbar, this)
					executeTimer.Start()
						
					getVal()
				)
			)
		)
			
		custAttributes.add ring ca_test
	)


Thanks, I’ll give it a look over!

Got it working! Thanks for the help

are you surprised? i’m not somehow

Glad you believe in me Denis

But I do still sometimes make stupid mistakes, like defining a function in the wrong place and then wondering why things don’t work…

Page 4 / 4