Rick -

Here is the code I am using.

RexxMethod5(int,                       // Return type
            GrxDialogNewWithButtons,   // Object_method name
            CSTRING, title,            // Dialog title
            RexxObjectPtr, parent,     // Parent window
            int, flags,                // Dialog flags
            ARGLIST, args,             // Array of buttons and responses
            OSELF, self)               // Self
{
    GtkWindow *myParent = NULL;
    GtkWidget *myWidget, *vbox;
    const gchar *bid;
    int rid;
    size_t members = context->ArraySize(args);

    if (parent != context->Nil()) {
        myParent = (GtkWindow *)context->ObjectToCSelf(parent);
    }
    myWidget = gtk_dialog_new_with_buttons(title, myParent,
                                           (GtkDialogFlags)flags, NULL);
    for (int i = 5; i <= members; i += 2) {
        bid = context->StringData((RexxStringObject)context->ArrayAt(args,
i - 1));
        context->ObjectToNumber(context->ArrayAt(args, i), &rid);
        gtk_dialog_add_button(GTK_DIALOG(myWidget), bid, rid);
    }

    // Save ourself
    context->SetObjectVariable("CSELF", context->NewPointer(myWidget));
    g_object_set_data(G_OBJECT(myWidget), "OORXOBJECT", self);

    // create the vbox object
    vbox = GTK_DIALOG(myWidget)->vbox;
    context->SendMessage1(self, "VBOX=", context->NewPointer(vbox));));

    return 0;
}

I had some debug statements in this that have been removed. I had one
statement that printed out the string value that was being converted to rid
and determined that the string value was correct. I also was displaying the
logical result of the conversion (always zero). And another statement
displaying the value of rid.

The odd loop start value is so that I make sure I always process two
existing array objects and don't try to process a pair with a non-existing
second entry.

I sure hope you can locate the problem here :-)

Thanks,
W. David Ashley
IBM Systems and Technology Group Lab Services
Open Object Rexx Team
Mobile Phone: 512-289-7506
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to