commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8794 - trunk/gnue-forms/src/GFObjects


From: reinhard
Subject: [gnue] r8794 - trunk/gnue-forms/src/GFObjects
Date: Mon, 16 Oct 2006 07:32:01 -0500 (CDT)

Author: reinhard
Date: 2006-10-16 07:32:00 -0500 (Mon, 16 Oct 2006)
New Revision: 8794

Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/GFObjects/GFField.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
Log:
Added focus_in(), validate(), and focus_out() functions for all focus aware
objects.


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-10-16 11:57:10 UTC (rev 
8793)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-10-16 12:32:00 UTC (rev 
8794)
@@ -1061,6 +1061,9 @@
 
         if self._form.get_focus_block() is self:
             self.focus_in()
+            field = self._form.get_focus_object().get_field()
+            if field is not None:
+                field.focus_in()
 
         self._form.beginEditing()
 
@@ -1071,10 +1074,18 @@
         self._form.endEditing()
 
         if self._form.get_focus_block() is self:
+            field = self._form.get_focus_object().get_field()
+            if field is not None:
+                field.validate()
             self.validate()
+            if field is not None:
+                field.focus_out()
             self.focus_out()
 
+
   # ---------------------------------------------------------------------------
+  # Focus handling
+  # ---------------------------------------------------------------------------
 
   def focus_in(self):
         """
@@ -1098,7 +1109,7 @@
         will be prevented.
         """
 
-        self.processTrigger('PRE-FOCUSOUT')
+        self.processTrigger('PRE-FOCUSOUT', ignoreAbort=False)
 
         if self.autoCommit and self.is_pending():
             self._form.execute_commit()

Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2006-10-16 11:57:10 UTC (rev 
8793)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2006-10-16 12:32:00 UTC (rev 
8794)
@@ -348,6 +348,44 @@
 
 
     # -------------------------------------------------------------------------
+    # Focus handling
+    # -------------------------------------------------------------------------
+
+    def focus_in(self):
+        """
+        Notify the field that it has received the focus.
+        """
+
+        self.processTrigger('PRE-FOCUSIN')
+        self.processTrigger('POST-FOCUSIN')
+
+    # -------------------------------------------------------------------------
+
+    def validate(self):
+        """
+        Validate the field to decide whether the focus can be moved away from
+        it.
+
+        This function can raise an exception, in which case the focus change
+        will be prevented.
+        """
+
+        self.processTrigger('PRE-FOCUSOUT', ignoreAbort=False)
+
+    # -------------------------------------------------------------------------
+
+    def focus_out(self):
+        """
+        Notify the field that it is going to lose the focus.
+
+        The focus change is already decided at this moment, there is no way to
+        stop the focus from changing now.
+        """
+
+        self.processTrigger('POST-FOCUSOUT')
+
+
+    # -------------------------------------------------------------------------
     # Event handling functions for datasource events
     # -------------------------------------------------------------------------
 

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-10-16 11:57:10 UTC (rev 
8793)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-10-16 12:32:00 UTC (rev 
8794)
@@ -123,3 +123,45 @@
                         box.addChild(item)
                         item.setParent(box)
                         parent = box
+
+
+    # -------------------------------------------------------------------------
+    # Focus in and out
+    # -------------------------------------------------------------------------
+
+    def focus_in(self):
+        """
+        Notify the entry that it has received the focus.
+        """
+
+        self.processTrigger('PRE-FOCUSIN')
+        self.processTrigger('POST-FOCUSIN')
+
+    # -------------------------------------------------------------------------
+
+    def validate(self):
+        """
+        Validate the entry to decide whether the focus can be moved away from
+        it.
+
+        This function can raise an exception, in which case the focus change
+        will be prevented.
+
+        Calling this function will implicitly update the value in the
+        associated GFField object.
+        """
+
+        self.processTrigger('PRE-FOCUSOUT')
+
+
+    # -------------------------------------------------------------------------
+
+    def focus_out(self):
+        """
+        Notify the entry that it is going to lose the focus.
+
+        The focus change is already decided at this moment, there is no way to
+        stop the focus from changing now.
+        """
+
+        self.processTrigger('POST-FOCUSOUT')

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-10-16 11:57:10 UTC (rev 
8793)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-10-16 12:32:00 UTC (rev 
8794)
@@ -222,6 +222,44 @@
 
 
     # -------------------------------------------------------------------------
+    # Focus handling
+    # -------------------------------------------------------------------------
+
+    def focus_in(self):
+        """
+        Notify the object that it has received the focus.
+        """
+
+        self.processTrigger('PRE-FOCUSIN')
+        self.processTrigger('POST-FOCUSIN')
+
+    # -------------------------------------------------------------------------
+
+    def validate(self):
+        """
+        Validate the object to decide whether the focus can be moved away from
+        it.
+
+        This function can raise an exception, in which case the focus change
+        will be prevented.
+        """
+
+        self.processTrigger('PRE-FOCUSOUT', ignoreAbort=False)
+
+    # -------------------------------------------------------------------------
+
+    def focus_out(self):
+        """
+        Notify the object that it is going to lose the focus.
+
+        The focus change is already decided at this moment, there is no way to
+        stop the focus from changing now.
+        """
+
+        self.processTrigger('POST-FOCUSOUT')
+
+
+    # -------------------------------------------------------------------------
     # UI focus movement
     # -------------------------------------------------------------------------
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]