For me, this is closer! The interface is very simple, nice and clean! Using this UI, it’s possible to change even the values of Red and Green depending on the value of Space!
try(destroydialog a) catch()
rollout a "Bad" width:200
(
group "Normal Map: "
(
label space_lb "Space:" across:2 align:#right offset:[-50,1]
radiobuttons space_rb labels:#("Local XYZ ", "Tangent") columns:2 align:#left offset:[-44,0] \
offsets:#([0,0], [5,0])
label red_lb "Red:" across:2 align:#right offset:[-50,5]
radiobuttons xdir_rb labels:#("Left", "Right") columns:2 align:#left offset:[-44,4] \
offsets:#([0,0], [14,0])
label green_lb "Green:" across:2 align:#right offset:[-50,-2]
radiobuttons ydir_rb labels:#("Down", "Up") columns:2 align:#left offset:[-44,-3] \
offsets:#([0,0], [20,0])
)
)
createdialog a pos:[600,200]
But only for max2013 and up.
Denis, while ago you have posted a script(snipped) how to add space between radiobuttons, but it is not pure maxscript.
Just because I can (max 2011+) :
try(destroydialog a) catch()
rollout a "Even worse" width:200
(
local labelPairs = #(
dataPair #space_rb #("Local XYZ", "Tangent"),
dataPair #xdir_rb #("Left", "Right"),
dataPair #xdir2_rb #("- X", "+ X"),
dataPair #ydir_rb #("Down", "Up"),
dataPair #ydir2_rb #("- Y", "+ Y")
)
local placeholders = #("________", "______")
group "Normal Map: "
(
label space_lb "Space:" across:2 align:#right offset:[-50,1]
radiobuttons space_rb labels:placeholders columns:2 align:#left offset:[-44,0]
label red_lb "Red:" across:2 align:#right offset:[-50,5]
radiobuttons xdir_rb labels:placeholders width:50 columns:2 align:#left offset:[-44,4] visible:(space_rb.state == 2)
radiobuttons xdir2_rb labels:placeholders columns:2 pos:xdir_rb.pos
label green_lb "Green:" across:2 align:#right offset:[-50,-2]
radiobuttons ydir_rb labels:placeholders columns:2 align:#left offset:[-44,-3] visible:(space_rb.state == 2)
radiobuttons ydir2_rb labels:placeholders columns:2 pos:ydir_rb.pos
)
on space_rb changed state do #(xdir2_rb, ydir2_rb).visible = not (#(xdir_rb, ydir_rb).visible = (space_rb.state == 2))
on a open do
(
for pair in labelPairs do
(
local hwnds = (getProperty a pair.v1).hwnd -- that's the 2011+ part
for i = 1 to pair.v2.count do UIAccessor.SetWindowText hwnds[i] pair.v2[i]
)
)
)
createdialog a pos:[600,200]
And no, I would never really use it.
It’s very nice workaround but seems a bit complicated. Also 2011+ support for standard mxs control is huge limitation. I would rather use here checkboxses which are set up to behave like radiobuttons.
Can we rearrange the radiobutons?
try(destroydialog a) catch()
rollout a "Bad" width:200
(
group "Normal Map: "
(
label space_lb "Space:" align:#left across:3
label red_lb "Red:" offset:[0,0]
label green_lb "Green:" offset:[0,0]
radiobuttons space_rb labels:#("Local XYZ", "Tangent") columns:1 align:#left across:4
radiobuttons xdir_rb labels:#("Left", "Right") width:50 columns:1 offset:[35,0] visible:(space_rb.state == 2)
radiobuttons xdir2_rb labels:#("+ X", "- X") columns:1 pos:xdir_rb.pos align:#center
radiobuttons ydir_rb labels:#("Down", "Up") columns:1 align:#left offset:[0,0] visible:(space_rb.state == 2)
radiobuttons ydir2_rb labels:#("+ Y", "- Y") columns:1 pos:ydir_rb.pos
)
on space_rb changed state do #(xdir2_rb, ydir2_rb).visible = not (#(xdir_rb, ydir_rb).visible = (space_rb.state == 2))
)
createdialog a pos:[600,200]
Here is example of another problematic mxs control (slider)
try(destroydialog ::slidRoll) catch()
rollout slidRoll "Slide" width:210 height:108
(
label lbl_1 "slider1 value: 0.0" pos:[5,5] width:200 height:15 style_sunkenedge:on
slider sld_1 "" pos:[11,20] ticks:10 range:[-50,50,0] width:200 type:#float
label lbl_2 "slider2 value: 0.0" pos:[5,54] width:200 height:15 style_sunkenedge:on
slider sld_2 "" pos:[11,69] ticks:10 range:[0,100,0] width:200 type:#float
on sld_1 changed val do lbl_1.text = "slider1 value: " + val as string
on sld_2 changed val do lbl_2.text = "slider2 value: " + val as string
)
createdialog slidRoll pos:[600,200] --bgcolor:black
Main problem is white border around slider control which shows every time when ctrl is focused. Second problem is position offset, width and height of 32px (i set offset 1px between label and slider to prevent overlapping). As you see for label x-pos is 5px and for slider 11px to align horizontally. Denis posted a nice example about scaling the size of slider on this forum. I know that we have not begun to talk about the use of .net controls but this can fix white border. All other problems stays unresolved.
try(destroydialog ::slidRoll) catch()
rollout slidRoll "Slide" width:210 height:108
(
local maxBC = (colorMan.getColor #background) * 255.0
local maxFC = (colorMan.getColor #Text) * 255.0
dotnetcontrol lbl_1 "Label" pos:[5,5] width:200 height:15
slider sld_1 "" pos:[11,20] ticks:10 range:[-50,50,0] width:200 type:#float
dotnetcontrol lbl_2 "Label" pos:[5,54] width:200 height:15
slider sld_2 "" pos:[11,69] ticks:10 range:[0,100,0] fieldwidth:200 type:#float
on slidRoll open do
(
lbl_1.ForeColor = lbl_2.ForeColor = (dotNetClass "System.Drawing.Color").FromArgb maxFC.x maxFC.y maxFC.z
lbl_1.BackColor = lbl_2.BackColor = (dotNetClass "System.Drawing.Color").FromArgb maxBC.x maxBC.y maxBC.z
lbl_1.Text = "slider1 value: 0.0" ; lbl_2.Text = "slider2 value: 0.0"
lbl_1.TextAlign = lbl_2.TextAlign = lbl_2.TextAlign.MiddleLeft
)
on sld_1 changed val do lbl_1.text = "slider1 value: " + val as string
on sld_2 changed val do lbl_2.text = "slider2 value: " + val as string
)
createdialog slidRoll pos:[600,200] --bgcolor:black
there is a trick… set ticks to 0. it flips slider cursor but makes whole control smaler
I know abou that, but what if I need ticks. Also bothers me output values that this ctrl throws.
thank you guys for so interesting solutions and actually new for me information. For example i didn’t know that rollout controls have hwnd now (thanks, Swordslayer). i’ve dreamed for it many years and couple months ago wrote c++ function to extend my mxs (thanks, miauu).
Good to now that the max added additional offsets for radiobuttons in v2013.
also I like very much galagast’s dropdownlists UI solution. it’s really very clean and easy to read
here are my versions based of his idea (i like them both):
try(destroydialog c) catch()
rollout c "Very Good" width:200
(
group "Normal Map:"
(
label space_lb "Space:" across:2 align:#right offset:[-27,2]
dropDownList space_dd width:111 items:#("Local XYZ", "Tangent") align:#right offset:[2,-2]
label red_lb "Red:" across:2 align:#right offset:[-27,6]
dropDownList red_dd width:111 items:#("Left", "Right") align:#right offset:[2,2]
label green_lb "Green:" across:2 align:#right offset:[-27,0]
dropDownList green_dd width:111 items:#("Down", "Up") align:#right offset:[2,-4]
)
)
createdialog c pos:[600,220]
try(destroydialog d) catch()
rollout d "Very Good" width:200
(
group "Normal Map:"
(
label space_lb "Space:" across:2 align:#right offset:[-27,2]
dropDownList space_dd items:#("Local XYZ", "Tangent") width:111 align:#right offset:[2,-2]
label redgreen_lb "Red/Green:" across:3 align:#right offset:[2,4]
dropDownList red_dd items:#("Left", "Right") width:55 align:#right offset:[4,0]
dropDownList green_dd items:#("Down", "Up") width:55 align:#right offset:[2,0]
)
)
createdialog d pos:[600,380]
and finally… this is how i solved this problem 8 years ago:
try(destroydialog b) catch()
rollout b "Good" width:200
(
group "Normal Map: "
(
label space_lb "Space:" across:2 align:#right offset:[-44,1]
radiobuttons space_rb labels:#("Local XYZ", "Tangent") columns:2 align:#left offset:[-37,0]
label red_lb "Red:" across:2 align:#right offset:[-44,5]
radiobuttons xdir_rb labels:#("Left", "Right", " ") columns:3 align:#left offset:[-37,4] visible:(space_rb.state == 2)
radiobuttons xdir2_rb labels:#("- X", "+ X", " ") columns:3 pos:xdir_rb.pos
label green_lb "Green:" across:2 align:#right offset:[-44,-2]
radiobuttons ydir_rb labels:#("Down", "Up", " ") columns:3 align:#left offset:[-37,-3] visible:(space_rb.state == 2)
radiobuttons ydir2_rb labels:#("- Y", "+ Y", " ") columns:3 pos:ydir_rb.pos
)
on space_rb changed state do #(xdir2_rb, ydir2_rb).visible = not (#(xdir_rb, ydir_rb).visible = (space_rb.state == 2))
)
createdialog b pos:[600,350]
as you can see I added third column but its shown off the rollout
This is a brilliant thread – thanks for starting it Denis and thanks to all the contributors!
Actually the third column is visible to the user on the right of the rollout and the radios are not aligned (cf attachment)
3dsMax 2012 x64
my is good… probably it’s max localization issue. do you use French or English version of max?
try to add one more “space” symbol to the third labels
I think that the porblem with controls alignment is… the Windows is the problem.
The same monitor on Windows XP,7,8 – I have a script whose controls are placed with offset(1-5 px) on all OS versions. I don’t know why. If I found this script again I will post it here.