Ok, now I’ve noticed something else. If at any point I open the track view, my range slider stops performing its functions. I can still move the indicators, but they don’t actually do anything. This persists even after closing the track view once it has been opened.
EDIT: That’s not the only thing that is causing the range slider to stop working. Apparently creating an object or performing various other actions will do this as well.
This is essentially what I have. It works when I create it, but any time I do basically anything else it stops. I’m assuming it’s a focus issue, but I’m a little confused about how to fix it.
Rollout RO "" (
local v1 = 175.0
local v2 = 185.0
local v = 180.0
local r = 5.0
dotNetControl tb "system.windows.forms.trackbar" height:25 width:200
label va "" align:#center
fn getVal = (
v = (v1 + v2) / 2
r = v - v1
va.text = v as string + " ± " + r as string
)
on RO open do (
tb.controls.add (
rtb = dotnetobject "DevExpress.XtraEditors.RangeTrackBarControl"
rtb.Properties.Minimum
rtb.Properties.Maximum = 36000
rtb.Properties.TickStyle = rtb.Properties.TickStyle.None
rtb.Value = dotnetobject "DevExpress.XtraEditors.Repository.TrackBarRange" 17500 18500
rtb.BorderStyle = rtb.BorderStyle.Style3D
rtb.Dock = rtb.Dock.Top
rtb
)
fn onEditValueChanging s a = (
v1 = (a.NewValue.Minimum as float) / 100
v2 = (a.NewValue.Maximum as float) / 100
getVal()
)
dotnet.addEventHandler rtb #EditValueChanging onEditValueChanging
getVal()
)
)
createDialog RO width:220
EDIT:
And then I tried it again and it worked fine no matter what I did. Then it didn’t, then it did again for a while, until it stopped working all by itself.
you have to make the control Lifetime to preserve from garbage collection:
dotnet.addEventHandler rtb #EditValueChanging onEditValueChanging
dotNet.setLifetimeControl rtb #dotnet
check the difference – not lifetime and lifetime… run the dialog and call gc()…
in the first case the control stops working…
I would never have figured that out in a million years
So thank you!
Hm… I’ve got something odd happening when I try and put this into a custom attribute rollout. When I select the object with the custom attribute in question, the slider bar initially appears but then immediately becomes invisible. It reappears when I mouse over it, but obviously this is not a desired feature. Any idea what might be causing/how to fix this?
many .net controls (almost all) stop working correct in body on mxs plugin (attribute).
i was showing a solution on this forum which is using GLOBAL TIMER to update and fire events of .net controls used in mxs plugins
Thanks, I’ll look for that thread!
EDIT: Or you can just post the link I guess x)