[Mono-list] Mouse Right Click capturing in Mono/Glade? Right Mouse Click
Menu?
Ian Parish
IPARISH@novell.com
Thu, 13 Jan 2005 15:09:44 -0700
This is a MIME message. If you are reading this text, you may want to
consider changing to a mail reader or gateway that understands how to
properly handle MIME multipart messages.
--=__Part86A62CB8.0__=
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
I'm Using Glade, and Monodevelop to create a little GUI program. I have
an IconList Widget that I have successfully populated. I am trying to
capture a right mouse click and display a Dropdown menu of options.
In the IconList I have added a signal for on_iconlist1_select_icon. In
the C++ code I have seen an example where the Gdk.Event.Type is a
ButtonType even and the button number is part of this structure. So you
just need to check for button ==3. The same code I have below here
gives a null pointer exception to any reference into the selectEvent
variable. Is this implemented? a Bug?
Is there a better different way to do this with Mono and C#
public void on_iconlist1_select_icon (object o,
IconSelectedArgs args)
{
System.Console.WriteLine("Clicked Icon Selected."+ args.Num );
System.Console.WriteLine("Clicked Icon Selected. " + args.Event );
// System.Console.WriteLine("Clicked Icon
Selected." + args.Event.Type.Button );
// Gdk.Event selectEvent = (Gdk.Event) args.Event;
// System.Console.WriteLine("Clicked Icon Selected."+
selectEvent.Type.Button );
// System.Console.WriteLine(args.Event.ToString());
//
System.Console.WriteLine(Gdk.EventType.ButtonPress.ToString());
// if (selectEvent.Type.ToString() ==
Gdk.EventType.ButtonPress.ToString())
{
// System.Console.WriteLine("Event Button Pressed");
}
// if (eb.Button == 3)
// {
// System.Console.WriteLine("Right Mouse Clicked for an Icon");
// }
}
// This signal I also added but it doesn't get called when and Icon is
selected, just when white space is selected.
public void on_iconlist1_button_press_event (object o, EventArgs
args)
{
System.Console.WriteLine("Button Press in IconList");
}
Thanks,
Ian
--=__Part86A62CB8.0__=
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"=
>
<META content=3D"MSHTML 6.00.2800.1479" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>I'm Using Glade, and Monodevelop to create a little GUI program. =
I have an IconList Widget that I have successfully populated. I am =
trying to capture a right mouse click and display a Dropdown menu of =
options.</DIV>
<DIV> </DIV>
<DIV>In the IconList I have added a signal for on_iconlist1_select_icon.&nb=
sp; In the C++ code I have seen an example where the Gdk.Event.Type =
is a ButtonType even and the button number is part of this structure.&=
nbsp; So you just need to check for button =3D=3D3. The same code I =
have below here gives a null pointer exception to any reference into =
the selectEvent variable. Is this implemented? a =
Bug?</DIV>
<DIV> </DIV>
<DIV>Is there a better different way to do this with Mono and C# </DIV=
>
<DIV> </DIV>
<DIV> </DIV>
<DIV>public void on_iconlist1_select_icon (object o,<BR>IconSelectedA=
rgs args)<BR> {</DIV>
<DIV> </DIV>
<DIV> System.Console.WriteLine("Clicked Icon =
Selected."+ args.Num );<BR> System.Console.WriteLine=
("Clicked Icon Selected. " + args.Event );<BR> <BR>/=
/ System.Console.WriteLine("Clicked Icon<BR>Selected." + =
args.Event.Type.Button );</DIV>
<DIV> </DIV>
<DIV>// Gdk.Event selectEvent =3D (Gdk.Event) args.Event;<=
BR>// System.Console.WriteLine("Clicked Icon Selected."+ =
selectEvent.Type.Button );<BR>// System.Console.WriteLine(=
args.Event.ToString());<BR> <BR> <BR>//&n=
bsp; <BR>System.Console.WriteLine(Gdk.EventType.ButtonPress.ToString()=
);<BR> <BR>// if (selectEvent.Type.ToStri=
ng() =3D=3D Gdk.EventType.ButtonPress.ToString())<BR> {<BR=
>// System.Console.WriteLine("Event Button =
Pressed");<BR> }</DIV>
<DIV> </DIV>
<DIV><BR> // if (eb.Button =3D=3D 3)<BR> // =
; {<BR>// System.Console.WriteLine(=
"Right Mouse Clicked for an Icon");<BR>// }<BR> &nbs=
p; <BR> }<BR> </DIV>
<DIV> </DIV>
<DIV>// This signal I also added but it doesn't get called when and Icon =
is selected, just when white space is selected.<BR> public =
void on_iconlist1_button_press_event (object o, EventArgs args)<BR>&n=
bsp; {<BR> System.Console.WriteLine("Butt=
on Press in IconList");<BR> }</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Ian</DIV>
<DIV><BR> </DIV></BODY></HTML>
--=__Part86A62CB8.0__=--