Implement scrolling, clickable and clipped GUI?

I am trying to build a scrolling advertisements line contains image links (like what we see in many websites), when users click on a link, we will need to handle corresponding action. Also, the advertisements line should be clipped (not running through the whole screen).

I could make the text scroll and clipped using this simple code:

float x = -5;
Texture adImage;

void OnGUI()
{
    GUI.BeginGroup(new Rect((Screen.width - width)/ 2, 50, width, height), backgroundImage);
    GUI.DrawTexture(new Rect(x, 10, 20, 20), adImage);
    GUI.EndGroup();
    if (x < width)
        x += 1;
    else
        x = -5;
}

But I cannot find way to assign OnClick event for the texture…

I tried to use GUITexture and I could make it scroll and clickable, however I have a problem with clipping with this solution as I couldn’t combine the scrolling code with GUI.BeginGroup / EndGroup…

Any suggestion?

For the ones who stuck in similar issues like mine, using GUI.Button (Rect position, Texture image, GUIStyle style) is what we need.

float x = -5;
Texture adImage;

void OnGUI()
{
    GUI.BeginGroup(new Rect((Screen.width - width)/ 2, 50, width, height), backgroundImage);
    [B][COLOR="red"]if (GUI.Button(new Rect(x, 10, 20, 20), adImage, GUIStyle.none))[/COLOR][/B]
            print("Clicked");
    GUI.EndGroup();
    if (x < width)
        x += 1;
    else
        x = -5;
}

Some things which might be helpful for more advanced approaches:

Event.current.type will give us the EventType, which we can check for EventType.MouseDrag, EventType.MouseUp and EventType.MouseDown…

Event.current.mousePosition provides the current mouse position in GUI space, relative to the current GUI.Group.

Rect object has .Contains(Event.current.mousePosition) method which returns true if mouse cursor is inside the defined rect.