mail-archives/gtk-sharp-list/2009-April/009567.html

171 строка
5.7 KiB
HTML
Исходник Постоянная ссылка Обычный вид История

2019-06-06 22:02:55 +03:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Help with widget not displaying in dialog
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Help%20with%20widget%20not%20displaying%20in%20dialog&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="009574.html">
<LINK REL="Next" HREF="009568.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Help with widget not displaying in dialog</H1>
<B>alan battersby</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Help%20with%20widget%20not%20displaying%20in%20dialog&In-Reply-To="
TITLE="[Gtk-sharp-list] Help with widget not displaying in dialog">alan.battersby at ntlworld.com
</A><BR>
<I>Sun Apr 19 15:55:54 EDT 2009</I>
<P><UL>
<LI>Previous message: <A HREF="009574.html">[Gtk-sharp-list] Heterogeneous Nodes In Gtk.NodeView / Gtk.NodeStore
</A></li>
<LI>Next message: <A HREF="009568.html">[Gtk-sharp-list] Help with widget not displaying in dialog
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9567">[ date ]</a>
<a href="thread.html#9567">[ thread ]</a>
<a href="subject.html#9567">[ subject ]</a>
<a href="author.html#9567">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Hi,
I have a problem, I have a dialog containing a widget I wrote to display
axis information. In turn this widget contains another widget to draw
the axes concerned in a drawingarea. When I run the dialog, the drawing
initially appears but then is cleared. When I click on a button to
rotate the axes then drawing appears again and stays visible. So could
someone suggest what I am doing wrong or how I can stop the drawingarea
from being cleared initially. Is it being cleared when I run the Dialog?
Thanks any help would be appreciated as Ive spent all afternoon trying
to solve this,
Alan
Code fragments are
public partial class AxismapDialog : Gtk.Dialog
{
public AxisMap AxisMap {
get {
return axismapdisplay.AxisMap;
}
set {
axismapdisplay.AxisMap = value;
}
}
public partial class AxismapDisplay : Gtk.Bin
{
AxisMap _map;
public AxisMap AxisMap {
get {
return _map;
}
set {
_map = value;
// code to set UI textfields etc
...
// SHOULD DRAW HERE
framedisplay1.Frame = _map.Frame;
framedisplay1.DrawAxes(); // put this in out of
desperation shouldn't need it
}
// in widget I have a buttons to rotate the axes
protected virtual void OnXrotBTNClicked (object sender,
System.EventArgs e)
{
_map.Frame.Rotate90(AXIS.X);
framedisplay1.DrawAxes(); // this works ok
}
}
public partial class FrameDisplay : Gtk.Bin
{
Frame _frame;
public Frame Frame {
get {
return _frame;
}
set {
_frame = value;
DrawAxes();
}
public void DrawAxes()
{
if (_frame == null) return;
drawingarea.GdkWindow.Clear();
using (Context ct =
Gdk.CairoHelper.Create(drawingarea.GdkWindow))
{
// now scale window and centre to origin
int height = 0,width = 0;
drawingarea.GdkWindow.GetSize(out width, out height);
l = (float)Math.Min(width/2,height/2);
ct.Translate(width/2,height/2);
// should be centred now
// first x axis
ct.Color = new Cairo.Color(1,0,0);
drawline(_frame.X,ct,l,AXIS.X.ToString());
// now y axis
ct.Color = new Cairo.Color(0,1,0);
drawline(_frame.Y,ct,l,AXIS.Y.ToString());
// now z axis
ct.Color = new Cairo.Color(0,0,1);
drawline(_frame.Z,ct,l,AXIS.Z.ToString());
}
}
}
//in main user window have a button to create and display the dialog.
protected virtual void OnAxismapbtnClicked (object sender,
System.EventArgs e)
{
AxismapDialog amd = new AxismapDialog();
amd.AxisMap = _codegen.AxisMap;
if (amd.Run() == (int)ResponseType.Ok)
{
_codegen.AxisMap = amd.AxisMap;
}
amd.Destroy();
axismaplabel.Text = _codegen.AxisMap.ShortString;
}
Dont know if this enough information to help.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="009574.html">[Gtk-sharp-list] Heterogeneous Nodes In Gtk.NodeView / Gtk.NodeStore
</A></li>
<LI>Next message: <A HREF="009568.html">[Gtk-sharp-list] Help with widget not displaying in dialog
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#9567">[ date ]</a>
<a href="thread.html#9567">[ thread ]</a>
<a href="subject.html#9567">[ subject ]</a>
<a href="author.html#9567">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>