Class: Gtk::LabeledEntry
Instance Method Summary collapse
- #clear ⇒ Object
- #get_value ⇒ Object
-
#initialize(label) ⇒ LabeledEntry
constructor
A new instance of LabeledEntry.
Constructor Details
#initialize(label) ⇒ LabeledEntry
Returns a new instance of LabeledEntry.
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
# File 'lib/grumblr/ui.rb', line 672 def initialize(label) @label = label super() self.modify_text Gtk::STATE_NORMAL, PALE self.set_text @label self.signal_connect(:focus_in_event) do |, type| if .text == @label .modify_text Gtk::STATE_NORMAL, DARK .set_text '' end false end self.signal_connect(:focus_out_event) do |, type| .clear if .text == '' false end self.show end |
Instance Method Details
#clear ⇒ Object
696 697 698 699 |
# File 'lib/grumblr/ui.rb', line 696 def clear self.modify_text Gtk::STATE_NORMAL, PALE self.set_text @label end |
#get_value ⇒ Object
691 692 693 694 |
# File 'lib/grumblr/ui.rb', line 691 def get_value value = self.text value == @label ? "" : value end |