[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.&nbsp;=
 I have an IconList Widget that I have successfully populated.&nbsp; I am =
trying to capture a right mouse click and display a Dropdown menu of =
options.</DIV>
<DIV>&nbsp;</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&nbsp; =
is a ButtonType even and the button number is&nbsp;part of this structure.&=
nbsp; So you just need to check for button =3D=3D3.&nbsp; The same code I =
have below here gives a null pointer exception to any reference into =
the&nbsp;selectEvent variable.&nbsp; Is this implemented?&nbsp; a =
Bug?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is there a better different way to do this with Mono and C#&nbsp;</DIV=
>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>public void on_iconlist1_select_icon&nbsp; (object o,<BR>IconSelectedA=
rgs args)<BR>&nbsp;&nbsp;&nbsp;{</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;System.Console.WriteLine("Clicked Icon =
Selected."+ args.Num );<BR>&nbsp;&nbsp;&nbsp;&nbsp;System.Console.WriteLine=
("Clicked Icon Selected. " + args.Event );<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>/=
/ &nbsp;&nbsp;&nbsp;System.Console.WriteLine("Clicked Icon<BR>Selected." + =
args.Event.Type.Button );</DIV>
<DIV>&nbsp;</DIV>
<DIV>//&nbsp;&nbsp;&nbsp;Gdk.Event selectEvent =3D (Gdk.Event) args.Event;<=
BR>//&nbsp;&nbsp;&nbsp;System.Console.WriteLine("Clicked Icon Selected."+ =
selectEvent.Type.Button );<BR>//&nbsp;&nbsp;&nbsp;System.Console.WriteLine(=
args.Event.ToString());<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;<BR>//&n=
bsp;&nbsp;<BR>System.Console.WriteLine(Gdk.EventType.ButtonPress.ToString()=
);<BR>&nbsp;&nbsp;&nbsp;<BR>//&nbsp;&nbsp;&nbsp;if (selectEvent.Type.ToStri=
ng() =3D=3D Gdk.EventType.ButtonPress.ToString())<BR>&nbsp;&nbsp;&nbsp;{<BR=
>//&nbsp;&nbsp;&nbsp;&nbsp;System.Console.WriteLine("Event Button =
Pressed");<BR>&nbsp;&nbsp;&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;//&nbsp;&nbsp;&nbsp;if (eb.Button =3D=3D 3)<BR>&nbsp;//&nbsp=
;&nbsp;&nbsp;{<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Console.WriteLine(=
"Right Mouse Clicked for an Icon");<BR>// &nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbs=
p;&nbsp;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;</DIV>
<DIV>&nbsp;</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>&nbsp;&nbsp;public =
void&nbsp; on_iconlist1_button_press_event (object o, EventArgs args)<BR>&n=
bsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.Console.WriteLine("Butt=
on Press in IconList");<BR>&nbsp;&nbsp;}</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>Ian</DIV>
<DIV><BR>&nbsp;</DIV></BODY></HTML>

--=__Part86A62CB8.0__=--