# Uninitialized constant Gdk::Keyval::

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-gdk/201058>\
**Category:** Ruby-Gnome 2\
**Created:** [December 29, 2010, 8:28am UTC](https://www.ruby-forum.com/t/uninitialized-constant-gdk/201058 "2010-12-29T08:28:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 29, 2010, 8:28am UTC](https://www.ruby-forum.com/t/uninitialized-constant-gdk/201058/1 "2010-12-29T08:28:14Z")

</div>

Hi,

I ran into the following: uninitialized constant Gdk::Keyval::GDK\_F5  
I have the following versions:  
x11-libs/gtk±2.22.1  
dev-libs/glib-2.26.1  
dev-ruby/ruby-gtk2-0.19.4  
I understand that the constant naming is changed in newer GTK+.  
How could i support newer and older constant namings? Should i use the  
value instead?

Thanks in advice,

---

<div class="post-metadata">

**Author:** ![SSDobai-Pataky\_BSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9a28c/32.png) [@SSDobai-Pataky\_BSSl](https://www.ruby-forum.com/u/SSDobai-Pataky_BSSl)\
**Post date:** [December 31, 2010, 3:00am UTC](https://www.ruby-forum.com/t/uninitialized-constant-gdk/201058/2 "2010-12-31T03:00:50Z")

</div>

2010/12/29 Dobai-Pataky B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> without downtime or disruption  
> [http://p.sf.net/sfu/oracle-sfdevnl](http://p.sf.net/sfu/oracle-sfdevnl)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

Hi.

The old names should be valid under gnome 2. I think they will be  
dropped in gnome 3.  
If needed you can define the new constants.  
Here is a small hack to be tested.

require ‘gtk2’

module Gdk  
module Keyval  
begin  
GDK\_KEY\_a  
rescue NameError  
constants.each{|key| const\_set('‘GDK\_KEY\_’+key[4..-1],  
eval(key))}#TODO : compare string key to /^GDK\_/  
end  
end  
end

–  
Vincent C.

---

<div class="post-metadata">

**Author:** ![SSDobai-Pataky\_BSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9a28c/32.png) [@SSDobai-Pataky\_BSSl](https://www.ruby-forum.com/u/SSDobai-Pataky_BSSl)\
**Post date:** [January 1, 2011, 10:48am UTC](https://www.ruby-forum.com/t/uninitialized-constant-gdk/201058/3 "2011-01-01T10:48:27Z")

</div>

This resolved it.  
Thanks Vincent
