How do I use a Class Queue,Type in my app?

Got a class which is has a Queue,Type which is being used inside the class, and this is just fine.

Rather than reproduce the Queue,Type in my app, I thought I could simply refer to it as

MyAppQ  Queue(MyClass.MyClassQType)

But the compiler doesnt like this, I get the error message
Syntax error: Field not found: MyClassQType

Any ideas?


Normally, I declare the queue type in the class .inc file.

MyClassQType, queue,type
Field1 long

The .inc file is already include in other places where you use the class, so the queue definition is available at that point.

MyAppQ queue(MyClassQType)
MyAppQ LIKE(MyClassQType)

You can also have your class return a reference to it’s internal queue if you want.


LIKE(MyClassQType) is a GROUP

Ways to instantiate:

QDerive  QUEUE(MyClassQType)
QRef     &MyClassQType
    QDerive.Field1 = 42; ADD(QDerive)

    QRef &= NEW MyCassQType
    QRef.Field1 = 142; ADD(QRef)

    ! at clean up...

See and .clw, for examples of how I like to declare typed queues in classes.
Notice how I create a GROUP,TYPE then declare the queue based on the group, type
this allows me to write methods that pass just the queue buffer as a group, vs. passing the whole queue.

Also notice my ctQueue class which I find really simplifies working with queues in classes.

CwUnit/ at master · MarkGoldberg/CwUnit (

CwUnit/ctAllTests.clw at master · MarkGoldberg/CwUnit (

I do this in the inc file and it works fine.

This works.

This doesnt.

My problem is I have the class declared in the global embeds so its got global scope of the app, and I thought I could use the Q type declared in the inc in the app, to create a procedure Q using the Q type from the class.

This doesnt seem to work though.

Oops, sorry about that. You are right about LIKE(). It was 6:20 in the morning. That’s my excuse and I’m sticking with it.

You can use a TYPE’ed QUEUE in a Global Class.

If you app is setup as a single EXE it’s very easy.

If it’s multi DLL, it’s still easy just more steps involved.

Just declare your CLASS in the GLOBAL data section of the EXE, or, if MULTI DLL in your “Data.DLL” like:

SomeName               Class(YourClass)


In an app where you want to use your Global CLASS, in the Global Data section:

SomeName		Class(YourClass),External,DLL(dll_mode)

Assuming your INC file is setup something like:

SomeQueueType		Queue,Type
SomeVarOne			String(10)
YourClass		Class,TYPE,MODULE('YourClass.clw'),Link('YourClass.clw',_ABCLinkMode_),DLL(_ABCDllMode_)
YourQ			&SomeQueueType

You should be able to access your Queue like:

YourClass.YourQ.SomeVarOne = 'Hello'

That should work, what’s failing ?

I was using Add(YourClass.YourQ) in the app procedure when all I needed was Add(YourQ) because it was Typed in the .inc file but outside of the YourClass,Type.

So just like equates declared in the .inc file but not inside the class type can conflict with equates in the app, its the same thing, the queue declared in the inc as a YourQ,Type but not declared inside the Class,Type doesnt need the YourClass if using it in an app procedure.

Silly mistake really but obvious with hindsight.

Another way:

MyAppQ MyClassQType

Something is different from what you’re describing here.
Can you please post some actual code.


I liked TYPE’d structures as they are just defining what the structure will be. It can be instantiated just about anywhere at any time.

Well I’m wondering about the copy of the OS or version of Clarion I have here, because yesterday, when using the directory function, I could only get = ‘…’ to work with clip( = ‘…’.

The … being the . and … that is left over from the old dos days seen in sub directory listing.

I’m beginning to think I’ve special edition or limited edition OS or version of Clarion!

1 Like