[Closed] activeX tabs question – update, refresh??
i have two activeX tabs, ONE and TWO
each one has a pickbutton inside a subrollout
when i pick an object, the pickbutton display the name and works properly like i want, but when i move back and forth by clicking the tabs, the names are gone…and i guess their still maintain the objects…and properties…
and i set the rightclick to clean all the properties…
someone can tell me how i set a function to update the view and leave the button working fine ??
my test :
--test polimeno ACTIVE X
rollout Rol_1 "test 1"
(
---------------
------ Ui ------
---------------
group "1"
(
pickbutton pbt "" offset:[0,0] tooltip:"pick point yellow"
) --end of group
---------------
-- Handlers ---
---------------
on pbt picked obj do
(
p1Obj = obj
if p1Obj != undefined
then
(
PtPick = obj
pbt.text = obj.name
flashNodes #(PtPick)
forceCompleteredraw()
global ptP_ = pbt.object
print (ptPick)
print (theClass)
print (pt_1)
print (theCategory)
print (ptP_)
)
else
(
obj = undefined
ptP_ = undefined
pbt.text = ""
print (obj)
print (ptP_)
)
)
on pbt rightclick do
(
clearListener ()
pbt.object = undefined
ptP_ = undefined
pbt.text = ""
print ("clear...1")
clearselection ()
)
)--end rollout
rollout Rol_2 "test 2"
(
---------------
------ Ui ------
---------------
group "2"
(
pickbutton p2 "" offset:[0,0] tooltip:"pick obj 2"
)--end of group
---------------
-- Handlers ---
---------------
on p2 picked obj do
(
if obj != undefined
then
(
PtPick2 = obj
p2.text = obj.name
flashNodes #(PtPick2)
forceCompleteredraw()
global ptP_2 = p2.object
print (ptPick2)
print (ptP_2)
)
else
(
obj = undefined
ptP_2 = undefined
p2.text = ""
print (obj)
print (ptP_2)
)
)
on p2 rightclick do
(
POBJ = p2.object
print (POBJ)
p2.text = POBJ.name as string
)
)--end rollout
---------------
-- UI activeX --
---------------
rollout taX "Active X test"
(
activeXcontrol acx_tabs "MSComctlLib.TabStrip.2" height:20
subRollout mySubRol "" height: (taX.height - 45)
on acx_tabs Click do
(
IndexTabs_ = acx_tabs.SelectedItem.index
case IndexTabs_ of
(
1:
(
removeSubRollout mySubRol Rol_2
addSubRollout mySubRol Rol_1
acx_tabs.tabs[1].HighLighted = true
acx_tabs.tabs[2].HighLighted = false
)
2:
(
removeSubRollout mySubRol Rol_1
addSubRollout mySubRol Rol_2
acx_tabs.tabs[1].HighLighted = false
acx_tabs.tabs[2].HighLighted = true
)
)
)-- end rollout
---------------
-- Handler X --
---------------
on taX open do
(
acx_tabs.tabs[1].caption = "ONE"
acx_tabs.tabs.add pvCaption:"TWO"
addSubRollout mySubRol Rol_1
)--end rollout
)--end
createDialog taX 360 640
thanks.
add this to the rollout definition (change the rollout and pickbutton name for the 2nd rollout, of course):
on Rol_1 open do (
if (isValidNode pbt.object) then (
pbt.text = pbt.object.name
)
)
That basically causes the pickbutton’s label to be re-set to that of the picked object when the rollout (re-)opens. The button’s behavior stays the same.
By the way, instead of using ‘pbt.text = obj.name’ in the ‘on pbt picked obj’ event, add “autoDisplay:true” to the pickbutton definition’s line. That will have the same effect
yes !
thanks man,
now it´s working !!
test code:
rollout Rol_1 "test 1"
(
---------------
------ Ui ------
---------------
group "1"
(
pickbutton pbt "" offset:[0,0] tooltip:"pick obj" autoDisplay:on
) --end of group
---------------
-- Handlers ---
---------------
on pbt picked obj do
(
pObj = obj
if pObj != undefined do
(
PtPick = obj
global ptP_ = pbt.object
print (ptP_)
)
)
on pbt rightclick do
(
clearListener ()
pbt.object = undefined
ptP_ = undefined
pbt.text = ""
print ("clear...")
)
on Rol_1 open do
(
if (isValidNode ptP_) then
(
pbt.text = ptP_.name
)
)
)--end rollout
---------------
-- UI activeX --
---------------
rollout taX "Active X test"
(
activeXcontrol acx_tabs "MSComctlLib.TabStrip.2" height:10
subRollout mySubRol "" height: (taX.height - 100)
on acx_tabs Click do
(
IndexTabs_ = acx_tabs.SelectedItem.index
case IndexTabs_ of
(
1:
(
removeSubRollout mySubRol Rol_2
addSubRollout mySubRol Rol_1
acx_tabs.tabs[1].HighLighted = true
acx_tabs.tabs[2].HighLighted = false
)
2:
(
removeSubRollout mySubRol Rol_1
addSubRollout mySubRol Rol_2
acx_tabs.tabs[1].HighLighted = false
acx_tabs.tabs[2].HighLighted = true
)
)
)-- end rollout
---------------
-- Handler X --
---------------
on taX open do
(
acx_tabs.tabs[1].caption = "ONE"
acx_tabs.tabs.add pvCaption:"TWO"
addSubRollout mySubRol Rol_1
)--end rollout
)--end
createDialog taX 360 640
but now i have another question :
is it possible to use the function “#style resize” on the dialog with some variable to maintain all the stuffs inside with the original offset ?
e.g.
button.pos.x = floater.borderLeft / 2
activeX.size = floater.size
to an extent, yes… you can:
- get/set the size of rollouts
- get/set the positions of controls
- get the size of only several controls (not all)
- set the size of even fewer controls
so, for example, you could use…
on tax resized sz do (
mySubRol.width = sz.x - 16
mySubRol.height = sz.y - 16
)
to keep the subrollout somewhat sized to the dialog – but the rollouts within will be stuck in size (have to re-add). Similarly, you can’t set the size of acx_tabs.
If you need things to work smoothly in that respect, now would be a good time to ponder moving over to .NET (ActiveX isn’t supported much anymore anyway)… or a least checking whether you really need the (sub)rollouts.
got that Richard,
thanks a lot for your explanation.
please,
can you show me a little test code with .NET with something similar on this topic ?
I would, but there’s several great threads on the topic of .NET tabs, switching UIs based on them, etc. already – perform a search for “dotnet tab” (sans quotes). Start at the bottom-most results, work your way up to the top (where the threads get into more advanced topics).
thanks, i´m doing it right now.
after a while looking in some threads i got this :
try(destroyDialog theRollout)catch()
rollout myRol "Testing .NET" width:200
(
dotNetControl dnc "system.windows.forms.tabcontrol" height:200
fn DNET theTabs =
(
t1 = dotNetObject "System.Windows.Forms.TabPage" "One"
t2 = dotNetObject "System.Windows.Forms.TabPage" "Two"
dnc.controls.add (t1)
dnc.controls.add (t2)
)
on myRol open do
(
DNET dnc
)
)
createDialog myRol
*EDIT:
DotNet
[left][color=blue] http://msdn2.microsoft.com/en-us/library/system.windows.forms.aspx [/color]
[/left]