Register to post in forums, or Log in to your existing account
 

This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.     Home » Forums » zApp Developers
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Tue Mar 15, 2005 6:27 pm   

ActiveX Controls
 
Using the latest build as of today.

I'm having trouble using any ActiveX controls but the IE one in demo.zml. I've tried several, including ones I've built, the standard VB textbox, and Microsoft's rich text box. In each case the first script to try to use it gives me an "object required" scripting error. I've tried scaling back the demo.zml example to accomodate this, and everying looks find up until the point at which I make the control switch.

The declaration doesn't produce an error message (swapping in a different control name in the activex block) but the first attempted use in a script does (even if it's the Navigate button that works for Explorer). The control doesn't appear to be loaded (same grey background color on the zApp form, wheras the textbox I was trying is white by default and the IE control shows up white).

Has anyone else had any success with this?

The three things I'm trying to do that I didn't find in the examples are:
1. ActiveX control
2. COM object that isn't a control
3. a few global variables

I know that I can simulate (2) if I can do (1), and (3) if I can do (1) or (2).

-Tarn
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Mar 15, 2005 6:47 pm   
 
Can you send me an ActiveX control file to play with along with your script? The IE ActiveX control is the only one that I have tried, and it's very possible that IE is doing something really wierd.

For 2) you need to declare your COM object in your script just like you normally do in VB Script. So, somewhere in your main WINDOW declaration in your ZML file you need something like:
Code:
set MyObject = createobject("MyDLLFile.Objectname")

then you can use MyObject elsewhere in your application.

For 3) Global variables, see the tag to create global ZML variables, or, in your VBscript, use the "DIM" command somewhere in your script. This will dimension a variable as global.

For the activeX control, my guess is that maybe you don't have the correct "classname" in the tag. For example, the classname for the IE web browser is "Shell.Explorer" which ended up being different that what some people are used to using in Visual Basic. You need to find out what the low-level COM class name for your activeX control is.

If it's not loading the control, than the classname is usually the problem.

But if I had some more examples of activeX controls, I might be able to make this all a bit easier.
Reply with quote
theNerd
Adept


Joined: 01 Mar 2005
Posts: 277

PostPosted: Tue Mar 15, 2005 7:07 pm   
 
Tarn,

Here is a quick example I whipped together to demonstrate using the treeview control from visual basic. Just copy and paste this into notepad and save as "ActiveX_Test.zml".

<window name="main">
<activex name='treex' align='client' classname='MSComctlLib.TreeCtrl'/>
<script>
with treex
.Nodes.Add , , "RootKey", "Root Node"
.Nodes.Add "RootKey", 4, "Second", "Child Node" ' the value 4 means "make it a child of node with key value "RootKey"
.Nodes("RootKey").Expanded = True
end with
</script>
</window>

It is important to use the correct class name in order to instantiate it. Also remember that the end-user (if you are going to distribute it) will need to be able to instantiate the control on their computer. Many controls when distributed do not allow it to be created in a design environment.

Also don't forget you can instantiate DLLs in VBScript using the CreateObject method. example:

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

If you need specific help on something please let me know and I will do my best to help you.

-Steven

Edited to Add: Zugg posted his response while I was writing this up.
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Tue Mar 15, 2005 8:13 pm   
 
Thanks guys. I was able to get a simple Hello World program going with the MS Rich Text box now that I pulled the correct name of the control right out of the registry (the OCX is richtx32.ocx).

<window name="main">
<activex name='test' align='client' classname='RichText.RichTextCtrl.1'/>
<script>
test.text = "hello world"
</script>
</window>

An error message on a failed load of a control might be a nice thing to add.

I'll look for the help on global variables- I know about CreateObject, but didn't know that using "Dim" within a script segment would make the object global and persistent for the rest of the zApp session.

-Tarn
Reply with quote
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Home » Forums » zApp Developers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
© 2009 Zugg Software. Hosted on Wolfpaw.net