mail-archives/gtk-sharp-list/2008-June/008750.html

91 строка
4.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] Strategy for Databinding Entry to Business Object Property
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Strategy%20for%20Databinding%20Entry%20to%20Business%20Object%0A%20Property&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="008749.html">
<LINK REL="Next" HREF="008751.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] Strategy for Databinding Entry to Business Object Property</H1>
<B>jaboo</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20Strategy%20for%20Databinding%20Entry%20to%20Business%20Object%0A%20Property&In-Reply-To="
TITLE="[Gtk-sharp-list] Strategy for Databinding Entry to Business Object Property">rbrinson at gmail.com
</A><BR>
<I>Mon Jun 23 19:27:09 EDT 2008</I>
<P><UL>
<LI>Previous message: <A HREF="008749.html">[Gtk-sharp-list] WHy doesn't TreeView.RulesHint work in Windows?
</A></li>
<LI>Next message: <A HREF="008751.html">[Gtk-sharp-list] A new Mono Blog
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8750">[ date ]</a>
<a href="thread.html#8750">[ thread ]</a>
<a href="subject.html#8750">[ subject ]</a>
<a href="author.html#8750">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
I have a little C#/GTK# project that I have been working on that is
presenting an interesting challenge to me. I have a traditional 3-tier
architecture with GTK# presenting the UI, a pure C# problem domain (business
layer), and a disk IO layer for the data access layer, since the app works
with JPG photos on the file system. The main business class is Picture, and
it has some properties that are displayed/edited at the UI level in
Gtk.Entry and Gtk.TextView objects.
Thus far, I have been managing the edit of these Entry/TextView objects by
capturing the existing Text value in the OnFocusInEvent and then comparing
that captured string to the Text property of the Entry/TextView object in
the OnFocusOutEvent. If they are not equal, then obviously a change was
made, and I update the Picture objects property.
Today, I recognized a problem with this strategy in that if the user clicks
on the Gtk.MenuBar or the Gtk.Toolbar, the OnFocusOutEvent is not triggered.
Thus updating the property on Picture does not occur, and the user may be
clicking on the Save toolbar button or Save menu item.
The only other property update strategy that I have been able to think of is
to use the OnChanged event of the Entry/TextView.Buffer object. However,
this event is fired everytime a character is typed or deleted. This seems
like it would be firing off way too many events.
The System.Windows.Forms.TextBox has a DataBindings property that can be
used to set the datasource for a TextBox. Does anything like this exist for
GTK#? Does anyone have another databinding strategy that they could suggest
or point to with a URL? Thanks for any insights.
--
View this message in context: <A HREF="http://www.nabble.com/Strategy-for-Databinding-Entry-to-Business-Object-Property-tp18080605p18080605.html">http://www.nabble.com/Strategy-for-Databinding-Entry-to-Business-Object-Property-tp18080605p18080605.html</A>
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="008749.html">[Gtk-sharp-list] WHy doesn't TreeView.RulesHint work in Windows?
</A></li>
<LI>Next message: <A HREF="008751.html">[Gtk-sharp-list] A new Mono Blog
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#8750">[ date ]</a>
<a href="thread.html#8750">[ thread ]</a>
<a href="subject.html#8750">[ subject ]</a>
<a href="author.html#8750">[ 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>