Arthur Mamou-Mani
Arthur Mamou-Mani

Reputation: 2333

Error: expected class,delegate,enum,interface or struct

I get the following error on the code below:

expected class,delegate,enum,interface or struct.

This happens when hovering on GH_ObjectResponse, what am I doing wrong?

public class SettingsComponentAttributes : GH_ComponentAttributes
{
    public SettingsComponentAttributes(IGH_Component SettingsComponent) :  
        base(SettingsComponent) {}
}

public override GH_ObjectResponse RespondToMouseDoubleClick(
    GH_Canvas sender, GH_CanvasMouseEvent e)
{
    ((SettingsComponent)Owner).ShowSettingsGui();
    return GH_ObjectResponse.Handled;
}

Upvotes: 0

Views: 4378

Answers (2)

Major Productions
Major Productions

Reputation: 6042

Watch your brackets. It should be:

public class SettingsComponentAttributes : GH_ComponentAttributes
{
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) {}

    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
    {
        ((SettingsComponent)Owner).ShowSettingsGui();
        return GH_ObjectResponse.Handled;
    }
}

Upvotes: 1

Glen Hughes
Glen Hughes

Reputation: 4822

Your method is not declared inside the class... try this instead:

public class SettingsComponentAttributes : GH_ComponentAttributes
{
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) { }

    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
    {
        ((SettingsComponent)Owner).ShowSettingsGui();
        return GH_ObjectResponse.Handled;
    }
}

Upvotes: 5

Related Questions