PDA

View Full Version : ActiveX ctrl as global var for access within functions


DonMeck
01-21-2005, 01:53 PM
Hey,

normally when I need to access something that is initialized later in the code,
I use (global) forward declarations. And usually it works. But somehow I can't make it work with an activeX control I'd like to access from several functions. :sad:

I tried something like this

macroscript ...
(

....
global myXControl
.....

function x1
(
....
myXControl.Add()
....
)

function x2
(
....
myXControl.Add()
....
)

etc. ...

rollout....
(
....
group "Output"
(
activeXControl myXControl "MSComctlLib.ListViewCtrl" height:400
)

....
)


---------

But I get runtime errors, as it says that myXControl is undefined.
Any idea?
thx

LFShade
01-21-2005, 06:18 PM
Rollout controls are always local to the rollout. Try forward-declaring your rollout instead, and then access the activex control as a property of the rollout.

macroscript ...
(

....
global myRollout
.....

function x1
(
....
myRollout.myXControl.Add()
....
)

function x2
(
....
myRollout.myXControl.Add()
....
)

etc. ...

rollout myRollout ...
(
....
group "Output"
(
activeXControl myXControl "MSComctlLib.ListViewCtrl" height:400
)

....
)

If that doesn't work, you may need to actually declare your rollout in its entirety first.


RH

DonMeck
01-24-2005, 04:35 PM
thank you. Haven't done much mxs stuff for a while - so I guess I got rusty regarding these topics.
Though I wasn't able to access it via the global rollout, I went thourgh the global declared floater: floater->rollout->control

cheers
dom

CGTalk Moderation
01-24-2006, 05:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.