473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Message dialog on 'focus-out-event'

import pygtk, gtk, gobject, ...

class MyEntry(gtk.Entry):
def __init__(self, is_OK):
gtk.Entry.__init__(self)
self.is_OK=is_OK
self.add_events(gtk.gdk.FOCUS_CHANGE)
self.focus_out_id=self.connect('focus-out-event',
self.on_focus_out)

def on_focus_out(self, sender, event):
if self.is_OK(self.get_text()): return False
else:
# don't want another focus-out-event because of show_message
self.disconnect(self.focus_out_id)
# self.grab_focus()
show_message("Wrong value for entry")
self.focus_out_id=self.connect('focus-out-event',
self.on_focus_out)
return False

# Leaving focus in not_OK case results:

# GtkWarning: GtkEntry - did not receive focus-out-event.
# If you connect a handler to this signal, it must return
# FALSE so the entry gets the event as well

# The required False is given, but may be the messagebox
# times it out.

# My second trial was to include self.grab_focus() before
# show_message, but it gives focus to the toplevel
# gtk.gdk.Window and I lose access to the entry.

# Any suggestions?
# Tuomas Vesterinen
Sep 18 '06 #1
0 1055

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marco Kunze | last post by:
Hi, when using user dialogfs in VBA I do not realy understand the dialog function actions. May anyone please explain me the actions 3 - 5? Thanks, Marco Function dialogfunc(DlgItem$,...
1
by: Sims | last post by:
Hi, I have a dialog box that ask the user to confirm a window operation. The user must confirm within a certain amount of time otherwise the operation is automatically cancelled. It all works...
0
by: Vladimir Perkic | last post by:
Hi! Does anybody know how can I create dialogbox which can be moved. Im using CreateDialog function. Also, System icon menu and "Close" button don't respond to mouse actions. Style I defined in...
1
by: Haobing | last post by:
I embeded an flash activex control to a wxPanel inherited class 'MyPanel' using wxPython's MakeActiveXClass method, and 'MyPanel' only has flash control ;But when then dialog init,the focus is not...
0
by: Roger Garrett | last post by:
I have an MFC dialog-based application. I have overridden the OnNcPaint method and draw some images in the non-client area of the dialog. It works just fine when, for example, some other window is...
1
by: mfc130603 | last post by:
Hi, My MFC app has dialogs that handle the WM_HELP message. Each dialog has its own context-help string that opens a corresponding page in an HTML Help file. It all works fine - execpt if the...
1
by: spur | last post by:
Hi, Ok I got 2 programs > Server > Client/Remote When I first run the server it will check for remote sites which have ip/rs232 devices listening, that are configured in the server database....
5
by: GraffixNYC | last post by:
We have a model dialog box(well a bunch of them) and it seems that when you cancel one of the in our application it will activate and bring the focus to another open window (not in our application)...
4
by: Steve | last post by:
Hi guys, You know how annoying it is when Visual Studio keeps asking you for a username and password to access TFS? I figured it would be easy to write a little System Tray utility that could...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.