Intelligent focus_out event trapping
- From: Shevek <shevek plaice valhalla net>
- To: gtk-list redhat com
- Subject: Intelligent focus_out event trapping
- Date: Tue, 5 May 1998 00:52:01 +0000 ( )
In writing a network database client in GTK (Similar to Oracle, Filemaker,
et al) it is convenient to send an update query to the database server
whenever a field is modified, and the cursor leaves the field (ie the user
commits the alterations).
I have found two signals possibly appropriate for this, but they both
have problems.
245 gtk_signal_connect_object (GTK_OBJECT (entry), "focus_out_event",
246 GTK_SIGNAL_FUNC (dv_temp1), NULL);
This is called whenever the focus leaves the widget. This is very good
indeed for most of the widgets on the form, but if you drag the window, or
move the mouse in or out of the window, this is called, even when the
contents of the entry have not actually changed, or the user has not
'committed' the changes.
247 gtk_signal_connect_object (GTK_OBJECT (entry), "changed",
248 GTK_SIGNAL_FUNC (dv_temp2), NULL);
This is called every character press, and so dosen't help much as it would
be a waste of bandwidth.
Have I missed anything here? Or is my only option to store a copy of the
string somewhere, and compare the user copy to the stored copy in RAM?
(I'd rather not, this would double my memory image), or to store the
currently focused widget, and compare the value of current widget to that
stored value every time? (About a 4-byte overhead on an 80x86, bearable).
If anyone has any neat solutions to this, I would be very grateful for
some information. Otherwise, I will probably write a function to implement
the second of the methods mentioned above. It's made a little trickier
because in this app absolutely everything has to be a pointer on the
stack, I can't instantiate a form as a static object as in testgtk.c
Thanks in advance for your help.
--
S.
GM/CS/MU -d+ H+>++ s+: !g p2 au0 !a w+++ v-(---) C++++$ UL++++$ UB+
US++ UI+++$ P+>++++ L++++$ 3+ E--- N+ K !W(-----) M+(-) !V -po+ Y+ t+
5++ !j !R G' !tv b+++ D++ B--- e+ u+* h++ f? r-- n---- y?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]