[Gtk-sharp-list] Weird gtk behaviour under windows.
George Farris
george at gmsys.com
Mon May 23 14:08:39 EDT 2005
I have an app that will remote and run under Linux great but when run
under Win2k it works a few times and then the entry widget no longer
shows up. It's very simple, the client connects to the remote object
and pops up a simple window asking for a line of text. There are two
buttons (cancel, print). Code follows:
Like I say I can run the server under Linux forever but under windows it
goes weird and displays everything but the entry widget after working a
couple of times.
Compiled under Linux, mono 1.0.5 and gtk#-1.9.2
Windows 2000 has the mono-1.1.7 version.
Any help greatly appreciated.
Remoting server code:
---------------------------------
using Gtk;
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Cupsacc-server running, listening on port
8080...");
ChannelServices.RegisterChannel(new HttpChannel(8080));
RemotingConfiguration.RegisterWellKnownServiceType(typeof(AccountNumber),
"control", WellKnownObjectMode.SingleCall);
Console.WriteLine("Application loop...");
Console.ReadLine();
}
}
public class AccountNumber : MarshalByRefObject
{
public string GetAccount()
{
Application.Init ();
MyWindow w = new MyWindow ();
Application.Run ();
return (w.AccountNo);
}
}
Gtk code
----------------------------------------------------------
using System;
using Gtk;
public class MyWindow : Window {
private string returnValue;
private Entry accountNo;
private Window window;
public MyWindow () : base ("Enter account code")
{
window = this;
//this.SetDefaultSize (400, 300);
this.DeleteEvent += new DeleteEventHandler (OnMyWindowDelete);
/* Sets the border width of the window. */
this.BorderWidth = 10;
HBox entrybox = new HBox();
entrybox.BorderWidth = 6;
entrybox.Spacing = 6;
HBox buttonbox = new HBox();
buttonbox.BorderWidth = 6;
buttonbox.Spacing = 6;
VBox vb = new VBox();
vb.Spacing = 6;
vb.PackStart(entrybox, false, false, 0);
vb.PackStart(buttonbox, false, false, 0);
vb.Show();
this.Add(vb);
Label l = new Label("Account Number");
accountNo = new Entry();
accountNo.Activated += accountNo_cb;
Button print = new Button("Print");
/* Connect the "clicked" signal of the button to our callback */
print.Clicked += print_cb;
Button cancel = new Button("Cancel");
cancel.Clicked += cancel_cb;
/* Pack and show all our widgets */
entrybox.Show();
entrybox.Add(l);
entrybox.Add(accountNo);
buttonbox.Show();
buttonbox.Add(print);
buttonbox.Add(cancel);
print.Show();
cancel.Show();
this.ShowAll ();
}
public string AccountNo
{
get { return returnValue; }
}
/* Our callback functions */
private void print_cb( object obj, EventArgs args)
{
returnValue = accountNo.Text;
window.Destroy();
Application.Quit();
}
private void accountNo_cb( object obj, EventArgs args)
{
returnValue = accountNo.Text;
window.Destroy();
Application.Quit();
}
private void cancel_cb( object obj, EventArgs args)
{
returnValue = null;
window.Destroy();
Application.Quit();
}
void OnMyWindowDelete (object o, DeleteEventArgs args)
{
returnValue = null;
window.Destroy();
Application.Quit ();
}
}
--
George Farris
george at gmsys.com
More information about the Gtk-sharp-list
mailing list