Control that not based on canvas

I want to add a visible control that not based on canvas. how can we do that? I need something like GtkContainer that can be used to add any control/widget.

Make your new control a subclass of Control or RectControl

I think, I’ve done this but still it’s a canvas-based control.

REALcontrol ctldef = {
// content of the structure
}

void PluginEntry()
{
    REALRegisterControl(&ctldef);
}

I’m thinking about this, but I also need to implement REALcontrolBehaviour

paste the whole REAL control structure
one of the fields in there is for the superclass

This is the structure

REALcontrol ctlDef = {
    kCurrentREALControlVersion,                         // version
    "MyControl",                                        // name
    sizeof(ctlData),                             // dataSize
    0,                                                  // flags
    0,                                                  // toolbarPICT
    0,                                                  // toolbarDownPICT
    100,                                                // defaultWidth
    100,                                                // defaultHeight
    Properties,                                      // properties
    sizeof(properties)/sizeof(REALproperty),         // propertyCount
    Methods,                                         // methods
    sizeof(Methods)/sizeof(REALmethodDefinition),    // methodCount
    Events,                                          // events
    sizeof(Events)/sizeof(REALevent),                // eventCount
    &Behavior,                                       // behaviour
    0,                                                  // forSystemUse, always zero
    NULL,                               // eventInstances
    0,                                  // eventInstanceCount
    NULL,                               // interfaces
    NULL,                               // attributes
    0,                                  // attributeCount
    NULL,                               // constants
    0,                                  // constantCount
#if kCurrentREALControlVersion >= 11
    NULL,                               // sharedProperties
    0,                                  // sharedPropertyCount
    NULL,                               // sharedMethods
    0,                                  // sharedMethodCount
    NULL,                               // delegates
    0,                                  // delegateCount
    NULL,                               // enums
    0,                                  // enumCount
#endif
    // end of structure
};

I’ve tried to add flags REALenabledControl | REALcontrolIsHIViewCompatible and still get the same canvas-based control.

I’ve tried to fake this by registering the control to the container of REALcontrolInstance passed along a function. It works fine until It’s used inside ContainerControl that placed inside a tabpanel.

Canvases can contain other controls

But if I understand you correctly thats not what you’re trying to achieve

If I understand correctly you want a control that at runtime can be some kind of chameleon and use it to instantiate ANY GTkControl somehow ?

Actually, no.

This is a simple example what exactly I will do. I want to add for example GtkButton (named MyButton) to Xojo window. So, I need a GtkContainer to attach MyButton. Hence in MyButton’s constructor.

void Constructor(REALcontrolInstance ctl)
{
    GtkWidget *button = gtk_button_new_with_label("Button");

    // I need something to replace this code,
    // e.q. GtkWidget *fixed = REALgetcontainer(ctl);
    GtkWidget *fixed = gtk_fixed_new();

    // So, I can put MyButton to the container
    gtk_fixed_put(GTK_FIXED(fixed), button, 150, 50);
}

ctl itself is a GtkDrawingArea that can’t be used to attach any widget.

Finally, I can fix this issue. But, I face another issue. I can reproduce it. You can check it in this thread https://forum.xojo.com/37960-bug-when-place-a-containercontrol-inside-tabpanel.