GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Aug 28, 2014 1:05 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to hide GtkEntry and still get key events
PostPosted: Wed Feb 15, 2012 5:01 pm 
Offline
Familiar Face

Joined: Thu Jan 21, 2010 10:23 am
Posts: 8
Hi all,

I have been using a GtkEntry to get some text when the user presses the keyboard. Then I get the text and keep it in a variable (gtk_entry_get_text).

So far, it works fine.

But what I want is to make that widget invisible (not to be seen) and still gets the pressed keys to store them in a variable.

If I hide the widget (Visible = FALSE) I get the following error:

Code:
Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT <widget, event> failed


Is there any way to have a hidden GtkEntry (or similar) that can get pressed keys?

Thank you in advance.

Best regards.


Top
 Profile  
 
 Post subject: Re: How to hide GtkEntry and still get key events
PostPosted: Wed Feb 15, 2012 6:33 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 745
Location: UK
Hi,

If you can explain a bit more what it is you want to achieve, then an alternative solution can be found. As it is if you hide the GtkEntry widget then it is not there to receive any events.

_________________
E.


Top
 Profile  
 
 Post subject: Re: How to hide GtkEntry and still get key events
PostPosted: Thu Feb 16, 2012 8:11 am 
Offline
Familiar Face

Joined: Thu Jan 21, 2010 10:23 am
Posts: 8
Hello Errol,

thanks for answering.

Let me explain the situation.

I have a peripherical which behaves like a keyboard (all the data is send as if you were pressing keys). So, it is not a real keyboard but you need a "place" to write on (e.g: a GtkEntry widget, a word document, a txt document, a terminal console, etc).

But in this case I need my own GTK application to retrieve that data. So:

    - I focus the GtkEntry just the moment the main window appears
    - Thus, the cursor is inside the GtkEntry and when I "activate" my peripherical, I succesfully get the data
    - The data is shown inside the GtkEntry

That works fine, but I want to retrieve that data transparently to the user. That is, no GtkEntry (or similar) must be visible. The problem is that, when hiding the widget, the error (Gtk-CRITICAL **: gtk_widget_event: assertion `WIDGET_REALIZED_FOR_EVENT <widget, event> failed) appears. That might mean that making the widget invisible is not an option.

Do you need more details?

Thank you very much.

Best regards.


Top
 Profile  
 
 Post subject: Re: How to hide GtkEntry and still get key events
PostPosted: Mon Feb 20, 2012 7:36 pm 
Offline
Never Seen the Sunlight

Joined: Mon Apr 28, 2008 5:52 am
Posts: 745
Location: UK
If the GtkEntry is not realized then it can not have certain actions operated on it. This will include many things including signals.

There could still be other options, but more information about the interface to your hardware (keyboard but not a real keyboard). But this may really be outside the scope of GTK, but still within Linux.

_________________
E.


Top
 Profile  
 
 Post subject: Re: How to hide GtkEntry and still get key events
PostPosted: Mon Feb 20, 2012 8:20 pm 
Offline
Familiar Face

Joined: Thu Jan 21, 2010 10:23 am
Posts: 8
All right Errol, I will try to find something different, not related to GTK+.

Thank you anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group