[Closed] Slider with multiple indicators?
Any way to make a slider bar with multiple sliders? Similar to the gradient ramp in the material editor, for example. I really only need two, since I’m going to be using it for range manipulation. I can use a curve control but it’s more than I need and takes up a lot of screen space.
I’m 99% sure Max doesn’t have anything like this built in, so I guess my question is, what sort of dotNet control am I looking for, and how do I open one in a Max rollout?
I’ve done something similar quite a while ago, feel free to take whichever part of the code you might like there; it’s not all that practical aproach, though – today, I’d write a custom control instead.
Hi Denis, can you give me a link to get started? Nothing is showing up in the help file, and I’m not finding anything relevant online…
Enjoy:
try(form.close()) catch()
(
global form = dotnetobject "MaxCustomControls.Maxform"
form.Text = "DevX Bars"
form.controls.add \
(
bt = dotnetobject "DevExpress.XtraEditors.ProgressBarControl"
bt.EditValue = 10
bt.Dock = bt.Dock.Top
bt
)
form.controls.add \
(
bt = dotnetobject "DevExpress.XtraEditors.ZoomTrackBarControl"
bt.EditValue = 10
bt.Dock = bt.Dock.Top
bt
)
form.controls.add \
(
bt = dotnetobject "DevExpress.XtraEditors.RangeTrackBarControl"
bt.Properties.Minimum
bt.Properties.Maximum = 100
bt.Properties.TickStyle = bt.Properties.TickStyle.None
bt.Value = dotnetobject "DevExpress.XtraEditors.Repository.TrackBarRange" 10 40
bt.BorderStyle = bt.BorderStyle.Style3D
bt.Dock = bt.Dock.Top
bt
)
form.Show()
ok
)
Wow. I ended up putting this project aside a long while back and now suddenly I am working again with the same control. I am 99% positive I was able to get this working before but if I did I can’t find the files where I did.
It would help me avoid a lot of trial and error if someone could show me how to set up handlers for a RangeTrackBarControl in a Maxscript rollout…
EDIT:
For example, the following works as expected:
try (destroyDialog RO) catch()
rollout RO "" (
dotNetControl tb "system.windows.forms.trackbar" height:25
on tb valueChanged val do (format "%
" tb.value)
)
createDialog RO
However, once the range trackbar has been added, nothing happens.
try (destroyDialog RO) catch()
rollout RO "" (
dotNetControl tb "system.windows.forms.trackbar" height:25
on RO open do (
tb.controls.add (
tbc = dotnetObject "DevExpress.XtraEditors.RangeTrackBarControl"
tbc.Properties.Minimum = 0
tbc.Properties.Maximum = 100
tbc.Properties.TickStyle = tbc.Properties.TickStyle.None
tbc.Value = dotnetObject "DevExpress.XtraEditors.Repository.TrackBarRange" 0 100
tbc.BorderStyle = tbc.BorderStyle.Style3D
tbc.Dock = tbc.Dock.Top
tbc
)
)
on tb valueChanged val do (
format "%
" tb.value as float
)
)
createDialog RO
Obviously I need to change how the handler works, but I don’t know what it needs instead.
this is how i usually find undocumented .net stuff:
try(form.close()) catch()
(
global form = dotnetobject "MaxCustomControls.Maxform"
form.Text = "DevX Bars"
form.controls.add \
(
bt = dotnetobject "DevExpress.XtraEditors.RangeTrackBarControl"
bt.Properties.Minimum
bt.Properties.Maximum = 100
bt.Properties.TickStyle = bt.Properties.TickStyle.None
bt.Value = dotnetobject "DevExpress.XtraEditors.Repository.TrackBarRange" 10 40
bt.BorderStyle = bt.BorderStyle.Style3D
bt.Dock = bt.Dock.Top
fn onValueChanged s a =
(
format "value changed %
" a
show a
)
fn onEditValueChanged s a =
(
format "edit value changed %
" a
show a
)
fn onEditValueChanging s a =
(
format "edit value changing % %
" a.NewValue a.OldValue
show a
show a.NewValue
)
--dotnet.addEventHandler bt #ValueChanged onValueChanged
--dotnet.addEventHandler bt #EditValueChanged onEditValueChanged
dotnet.addEventHandler bt #EditValueChanging onEditValueChanging
bt
)
form.Show()
ok
)
/*
showmethods ...
showevents ...
*/
Okay, I’ll see what I can do with that and let you know if I figure it out.
as you can see the most appropriate event is EditValueChanging with its argument properties New and Old values.
Okay, I got it now. I actually tried doing this before, but didn’t realize that the dotNet event handler had to be added inside the rollout open handler. And of course Max wouldn’t accept it in the scope of the rollout itself, giving me
– Syntax error: at ., expected name
– In line: dotnet.a
I’ve obviously been away from dotNet controls for too long. I need to re-familiarize myself with them.