|
Revision 4703, 0.8 kB
(checked in by ed, 2 months ago)
|
Minor comment re-formatting.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
# -*- coding: utf-8 -*- |
|---|
| 2 |
""" dControlMixin.py: Provide behavior common to all dControls """ |
|---|
| 3 |
|
|---|
| 4 |
import dabo |
|---|
| 5 |
import dabo.ui |
|---|
| 6 |
from dabo.dLocalize import _ |
|---|
| 7 |
import dabo.dEvents as dEvents |
|---|
| 8 |
|
|---|
| 9 |
class dControlMixinBase(dabo.ui.dPemMixin): |
|---|
| 10 |
""" Provide common functionality for all controls. |
|---|
| 11 |
""" |
|---|
| 12 |
def _initEvents(self): |
|---|
| 13 |
super(dControlMixinBase, self)._initEvents() |
|---|
| 14 |
|
|---|
| 15 |
self.bindEvent(dEvents.GotFocus, self.__onGotFocus) |
|---|
| 16 |
|
|---|
| 17 |
def __onGotFocus(self, evt): |
|---|
| 18 |
if self.Form: |
|---|
| 19 |
# Grab reference to current ActiveControl |
|---|
| 20 |
sfac = self.Form.ActiveControl |
|---|
| 21 |
# Set the form's ActiveControl reference |
|---|
| 22 |
self.Form._activeControl = self |
|---|
| 23 |
if sfac is not None and sfac is not self: |
|---|
| 24 |
# make sure prior control's value has been flushed |
|---|
| 25 |
self.Form.activeControlValid() |
|---|
| 26 |
if self.Parent: |
|---|
| 27 |
self.Parent._activeControl = self |
|---|