[Gambas-user] Component, GB.Raise, Event, Collection argument
Christian Faure
christian.faurebouvard at ...357...
Fri Sep 3 05:21:23 CEST 2004
Hello Benoit!
i'am working on a gambas-component
No problems when using String parameters, but
when use a Collection as parameter, i get an unexpected error an program stop.
my problem is how to pass a Collection as event param
C code:
...
DECLARE_EVENT(MyEvent);
static void test (void *_object){
GB_COLLECTION * MyCollection;
GB_VARIANT_VALUE MyValue;
//create a new collection object
GB.Collection.New ( MyCollection , GB_COMP_TEXT );
//add a string item
MyValue._string.value="MyStringValue";
GB.Collection.Set ( MyCollection, "MyKey", 5 , &MyValue);
//Raise event with collection param
GB.Raise(THIS, MyEvent, 1, GB_T_OBJECT, MyCollection);
}
...
GB_DESC CMyClassDesc[] =
{
...
GB_EVENT("MyEvent", NULL, "(MyCollection)o", &MyEvent),
...
}
Gambas code:
...
sub MyComp_MyEvent(MyCollection as object)
print MyCollection.Count
end sub
...
Can you help me?
What is wrong?
Are correct the sequence for create and adding an item to a Collection?
Very thanks.
More information about the User
mailing list