[Closed] Clear UI TabPage in PolyUnwrapper Toolbar
hello,I can find many examples for Making a Tabpage UI here,like using dotNet,hide by GroupBox,subRollout with no border. etc.
but i really love the case in Jorge’s PolyUnwrapper Toolbar,it’s clear enough and i can add more fixed UI Controls out of tabPage.
show me the best way to make it clear plz.
It is very simple stuff.
Here is a template for you to play.
(
try destroydialog ::RO_CUSTOM_TABS catch()
rollout RO_CUSTOM_TABS "Custom Tabs" width:256 height:192
(
checkbutton ckb1 "Tab 1" pos:[ 8,8] width:80 height:24
checkbutton ckb2 "Tab 2" pos:[ 88,8] width:80 height:24
checkbutton ckb3 "Tab 3" pos:[168,8] width:80 height:24
colorPicker cp1 "" pos:[ 4,44] fieldwidth:80 height:24 color:[200,50,50] -- TAB 1
colorPicker cp2 "" pos:[ 84,44] fieldwidth:80 height:24 color:[50,200,50] -- TAB 2
colorPicker cp3 "" pos:[164,44] fieldwidth:80 height:24 color:[50,50,200] -- TAB 3
button bt1 "Button 1" pos:[ 8,72] width:80 height:32 -- TAB 1
button bt2 "Button 2" pos:[ 88,72] width:80 height:32 -- TAB 2
button bt3 "Button 3" pos:[168,72] width:80 height:32 -- TAB 3
/* Fixed, always visible controls ------------------------------------------------------------ */
label lbl1 "" pos:[8,122] width:240
progressBar pb1 "" pos:[8,144] width:240 value:50 color:black
spinner spn1 "Percentage:" pos:[144,168] width:104 range:[0,100,50] type:#integer scale:0.1
/* ------------------------------------------------------------------------------------------- */
fn SetColor c =
(
lbl1.text = "Currect Selected Color: " + (c as string)
pb1.color = c
pb1.value = spn1.value = c.h / 2.55
)
on ckb1 changed arg do ()
on ckb2 changed arg do ()
on ckb3 changed arg do ()
on bt1 pressed do SetColor cp1.color
on bt2 pressed do SetColor cp2.color
on bt3 pressed do SetColor cp3.color
on spn1 changed arg inSpin do pb1.value = arg
)
createdialog RO_CUSTOM_TABS style:#(#style_toolwindow, #style_sysmenu)
)
“Fixed” control should always be visible, regardless of which Tab is selected.
“cp1” and “bt1” should be visible in “Tab 1”
“cp2” and “bt2” should be visible in “Tab 3”
“cp3” and “bt3” should be visible in “Tab 3”
How would you do it?
thanks for your template,Jorge
here’s a stupid way i using usually, can you show me something smart?
(
try destroydialog ::RO_CUSTOM_TABS catch()
rollout RO_CUSTOM_TABS "Custom Tabs" width:256 height:192
(
checkbutton ckb1 "Tab 1" pos:[ 8,8] width:80 height:24 checked:true
checkbutton ckb2 "Tab 2" pos:[ 88,8] width:80 height:24
checkbutton ckb3 "Tab 3" pos:[168,8] width:80 height:24
colorPicker cp1 "" pos:[ 4,44] fieldwidth:80 height:24 color:[200,50,50] -- TAB 1
colorPicker cp2 "" pos:[ 84,44] fieldwidth:80 height:24 color:[50,200,50] visible:false -- TAB 2
colorPicker cp3 "" pos:[164,44] fieldwidth:80 height:24 color:[50,50,200] visible:false -- TAB 3
button bt1 "Button 1" pos:[ 8,72] width:80 height:32 -- TAB 1
button bt2 "Button 2" pos:[ 88,72] width:80 height:32 visible:false -- TAB 2
button bt3 "Button 3" pos:[168,72] width:80 height:32 visible:false -- TAB 3
/* Fixed, always visible controls ------------------------------------------------------------ */
label lbl1 "" pos:[8,122] width:240
progressBar pb1 "" pos:[8,144] width:240 value:50 color:black
spinner spn1 "Percentage:" pos:[144,168] width:104 range:[0,100,50] type:#integer scale:0.1
/* ------------------------------------------------------------------------------------------- */
fn SetColor c =
(
lbl1.text = "Currect Selected Color: " + (c as string)
pb1.color = c
pb1.value = spn1.value = c.h / 2.55
)
/* ------------------------------------------------------------------------------------------- */
fn tabUp tabSel =
(
ckb1.checked = ckb2.checked = ckb3.checked = false
tabSel.checked = true
)
fn ctrlsVisible tabCtrls isShow =
(
tab1Ctrls = #(cp1,bt1)
tab2Ctrls = #(cp2,bt2)
tab3Ctrls = #(cp3,bt3)
tabAllCtrls = tab1Ctrls + tab2Ctrls + tab3Ctrls
for i in tabAllCtrls do i.visible = false
for c in tabCtrls do c.visible = isShow
)
on ckb1 changed arg do (
if arg == true then ( ctrlsVisible tab1Ctrls true; tabup ckb1 ) else ( ctrlsVisible tab1Ctrls false )
)
on ckb2 changed arg do (
if arg == true then ( ctrlsVisible tab2Ctrls true; tabup ckb2 ) else ( ctrlsVisible tab2Ctrls false )
)
on ckb3 changed arg do (
if arg == true then ( ctrlsVisible tab3Ctrls true; tabup ckb3 ) else ( ctrlsVisible tab3Ctrls false )
)
on bt1 pressed do SetColor cp1.color
on bt2 pressed do SetColor cp2.color
on bt3 pressed do SetColor cp3.color
on spn1 changed arg inSpin do pb1.value = arg
)
createdialog RO_CUSTOM_TABS style:#(#style_toolwindow, #style_sysmenu)
)
Perfect! That’s the idea, very simple as you can see
I can show you another way, but I wouldn’t call it smart. There are many ways to do the same thing, but in the background it is just hiding/unhiding stuff or moving it off/on screen.
(
try destroydialog ::RO_CUSTOM_TABS catch()
rollout RO_CUSTOM_TABS "Custom Tabs" width:256 height:192
(
checkbutton ckb1 "Tab 1" pos:[ 8,8] width:80 height:24
checkbutton ckb2 "Tab 2" pos:[ 88,8] width:80 height:24
checkbutton ckb3 "Tab 3" pos:[168,8] width:80 height:24
colorPicker cp1 "" pos:[ 4,44] fieldwidth:80 height:24 color:[200,50,50] visible:false
colorPicker cp2 "" pos:[ 84,44] fieldwidth:80 height:24 color:[50,200,50] visible:false
colorPicker cp3 "" pos:[164,44] fieldwidth:80 height:24 color:[50,50,200] visible:false
button bt1 "Button 1" pos:[ 8,72] width:80 height:32 visible:false
button bt2 "Button 2" pos:[ 88,72] width:80 height:32 visible:false
button bt3 "Button 3" pos:[168,72] width:80 height:32 visible:false
label lbl1 "" pos:[8,122] width:240
progressBar pb1 "" pos:[8,144] width:240 value:50 color:black
spinner spn1 "Percentage:" pos:[144,168] width:104 range:[0,100,50] type:#integer scale:0.1
local tabs = #(ckb1, ckb2, ckb3)
local groups = #(#(cp1, bt1), #(cp2, bt2), #(cp3, bt3))
fn SwitchTab tab =
(
tabIdx = finditem tabs tab
tabs.checked = false
for j in groups do j.visible = false
tabs[tabIdx].checked = true
groups[tabIdx].visible = true
)
fn SetColor c =
(
lbl1.text = "Currect Selected Color: " + (c as string)
pb1.color = c
pb1.value = spn1.value = c.h / 255.0 * 100
)
on ckb1 changed arg do SwitchTab ckb1
on ckb2 changed arg do SwitchTab ckb2
on ckb3 changed arg do SwitchTab ckb3
on bt1 pressed do SetColor cp1.color
on bt2 pressed do SetColor cp2.color
on bt3 pressed do SetColor cp3.color
on spn1 changed arg inSpin do pb1.value = arg
)
createdialog RO_CUSTOM_TABS style:#(#style_toolwindow, #style_sysmenu)
)
Most important, find a way to keep it organized if you plan to expand or modify it in the future. There are also several different ways of doing it.
i wrote a special structure for things like these…
i’m using “Group Control”. because mxs doesn’t allow nested ‘group controls’ (as well as any other rollout controls except rollout itself) it’s easy to find all controls between GroupStartControl and GroupEndControl.
so there are methods in the structure: Visible by group, Enable by Group, etc.