Gtk# Mouse fuera de un widget.
- From: Phillip Neumann <phillip sofsis cl>
- To: gnome-cl-list gnome org
- Subject: Gtk# Mouse fuera de un widget.
- Date: Sat, 22 Apr 2006 01:02:15 -0400
Hola!...
Jugando con gtk#, me obsesione un poco, y quise hacer un tipico
"OnMouseOver" ala html/javascript.
No se me ocurre como implementar que la ventana popup se esconda cuando
el mouse no esta en el widget en cuestion.
En este ejemplo el widget es un TreeView.
Desde donde se podria esconder la ventana?
saludos!
// project created on 21/04/2006 at 22:25
using System;
using Gtk;
namespace mouseover
{
public class PopW: Window
{
public PopW(): base("pops")
{
WidthRequest = 200;
Decorated = false;
Add(new Label("Hazme\ndesaparecer!"));
}
public void Aqui(int x, int y)
{
ShowAll();
this.KeepAbove = true;
Move(x+10,y+5);
}
}
public class AppWindow: Gtk.Window
{
TreeView tv;
PopW popCorn;
public AppWindow (): base ("MouseOver")
{
popCorn = new PopW();
BorderWidth = 10;
WidthRequest = 300;
HeightRequest = 250;
tv = new TreeView();
tv.Model = new ListStore (typeof(string));
MoveFocus += OnMouseOut; //<----------------�?
tv.MotionNotifyEvent += OnMouseOver;
VBox hb = new VBox();
hb.PackStart(new Label("Hola"),false,false,0);
hb.PackStart(new Label("hola"),false,false,0);
hb.PackStart(new Label("Cacerola"),false,false,0);
hb.PackStart(tv);
hb.PackStart(new Label("Empanada"),false,false,0);
hb.PackStart(new Entry("de"),false,false,0);
hb.PackStart(new Label("Queso"),false,false,0);
Add(hb);
ShowAll();
}
public void OnMouseOver(object o, MotionNotifyEventArgs a)
{
popCorn.Aqui( (int) a.Event.XRoot, (int) a.Event.YRoot);
}
public void OnMouseOut(object o, EventArgs a)
{
popCorn.HideAll();
}
}
class MainClass
{
public static void Main (string[] args)
{
Application.Init ();
new AppWindow ();
Application.Run ();
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]