有条件地设置OLE定义 [英] Conditionally set OLE definition

查看:134
本文介绍了有条件地设置OLE定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

号角中,我希望动态设置OLE的定义在一个窗口中.现在,这就是我在窗口中定义两个OLE对象的方式:

In Clarion, I'm looking to set the definition for an OLE dynamically in a window. Right now, this is how I define two OLE objects in a window:

Window WINDOW('Test ActiveX Window'), AT(,,431,92), FONT('MS Sans Serif', 8,, FONT:regular), COLOR(COLOR:White), CENTER, ALRT(F2Key), TIMER(10), GRAY
        OLE, AT(10,3,11,7), USE(?MyOLE1), HIDE, CREATE('MyActiveX.MyActiveXCtrl.1'), COMPATIBILITY(021H) END
        OLE, AT(30,3,11,7), USE(?MyOLE2), HIDE, CREATE('SomeOtherActiveX.SomeOtherActiveXCtrl.1'), COMPATIBILITY(021H) END
    END

两个对象都包含相同的方法定义(例如TestMethod),几乎就像它们实现了公共接口一样.我目前可以有条件地这样称呼他们:

Both objects contain the same method definitions (ex. TestMethod), almost like they implement a common interface. I can currently call them conditionally like this:

if (condition)
    testStr = ?MyOLE1{'TestMethod(param1)'}
else
    testStr = ?MyOLE2{'TestMethod(param1)'}
end

我想做的只是创建一个对象,然后动态设置控件的定义.我知道还有其他方法可以简化此过程(OCX包装程序等),但是根据项目的要求,这是必须完成的方法.在某些时候,这段代码将从2个对象增长到更多,这将使代码更整洁.

What I'd like to do is only create one object, and then dynamically set the control's definition. I know there are other ways to simplify this (OCX wrappers, etc), but based on the project's requirements, this is how it has to be done. At some point, this code will grow from 2 objects to many more and this will be a lot cleaner.

如何动态设置控件的定义(MyActiveX.MyActiveXCtrl.1部分)?

How can I dynamically set the control's definition (the MyActiveX.MyActiveXCtrl.1 part)?

推荐答案

以下是如何动态创建OLE对象的方法:

Here is how to create an OLE object dynamically:

Data

    MyOLE Long

Code

    MyOLE = 0
    MyOLE = Create(0, CREATE:OLE)

    ! Set the OLE's control definition dynamically:
    if (condition)
        ?MyOLE{PROP:Create} = 'ACTIVEXIDTECH.ActiveXIDTechCtrl.1'
    else
        ?MyOLE{PROP:Create} = 'SomeOtherActiveX.SomeOtherActiveXCtrl.1'
    end

这篇关于有条件地设置OLE定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆