Class: MyRendererRadioGroup
- Inherits:
-
Gtk::ScrolledWindow
- Object
- Gtk::ScrolledWindow
- MyRendererRadioGroup
- Includes:
- ManqodCommon
- Defined in:
- lib/FormHolder/Form/InputHolder/RadioGroup.rb
Overview
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])
Constant Summary
Constants included from ManqodCommon
ManqodCommon::CRITICAL, ManqodCommon::DEBUG, ManqodCommon::ERROR, ManqodCommon::INFO, ManqodCommon::NORMAL, ManqodCommon::WARNING
Constants included from Eprint
Instance Attribute Summary collapse
-
#first ⇒ Object
Returns the value of attribute first.
-
#items ⇒ Object
Returns the value of attribute items.
-
#pc ⇒ Object
Returns the value of attribute pc.
-
#selected ⇒ Object
Returns the value of attribute selected.
Instance Method Summary collapse
-
#initialize(pc) ⇒ MyRendererRadioGroup
constructor
A new instance of MyRendererRadioGroup.
- #inspect ⇒ Object
- #item ⇒ Object
- #parentM ⇒ Object
- #text ⇒ Object
- #to_s ⇒ Object
- #update(new_value = ) ⇒ Object
Methods included from ManqodCommon
#add_where, #admin, #admin_cache, #admin_qrow, #admin_rows, #backtrace_to_debug, #cache, #changed_ids_of_base, #client, #client_fields, #client_image_of_id, #client_qrow, #client_query, #client_rows, #eeval, #escape_string, #getBinding, #guess_base, #guess_table, #image_of_id, #lzero, #manqod_db, #measure, #myexec, #nick, #nick_id, #number_format, #qrow, #query, #reconnect_manqod_db, #rows, #run_events, #send_message, #sendmail, #set_manqod_db_uri, #set_nick
Methods included from Eprint
#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception
Constructor Details
#initialize(pc) ⇒ MyRendererRadioGroup
Returns a new instance of MyRendererRadioGroup.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 7 def initialize(pc) super() set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC) (@widget=Gtk::VBox.new) @pc=pc @selected="-1" @items=Hash.new @first=nil item['admin']=true item['querysql']="select cdata,cdisplay,description from scv where combo='#{item['data']}' order by cdata" end |
Instance Attribute Details
#first ⇒ Object
Returns the value of attribute first.
20 21 22 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 20 def first @first end |
#items ⇒ Object
Returns the value of attribute items.
20 21 22 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 20 def items @items end |
#pc ⇒ Object
Returns the value of attribute pc.
19 20 21 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 19 def pc @pc end |
#selected ⇒ Object
Returns the value of attribute selected.
21 22 23 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 21 def selected @selected end |
Instance Method Details
#inspect ⇒ Object
76 77 78 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 76 def inspect "RadioGroup(#{item["description"]})" end |
#item ⇒ Object
70 71 72 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 70 def item pc.item end |
#parentM ⇒ Object
67 68 69 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 67 def parentM pc.parentM end |
#text ⇒ Object
73 74 75 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 73 def text selected end |
#to_s ⇒ Object
79 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 79 def to_s;inspect;end |
#update(new_value = ) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/FormHolder/Form/InputHolder/RadioGroup.rb', line 23 def update(new_value=item['default']) item['default']=new_value run_events(item['id'],'form_item-BeforeUpdate') items.each_value{|rb| rb.destroy} items.clear @selected=item['default'] if item['admin'] q=parentM.admin.query(eeval("\"#{item['querysql']}\"")) else q=parentM.query(eeval("\"#{item['querysql']}\"")) end if q while row=q.fetch_hash() rb=if items.length==0 @first=Gtk::RadioButton.new(row['cdisplay']) else Gtk::RadioButton.new(first,row['cdisplay']) end to_activate=rb if row['cdata']==item['default'] #.set_sensitive(item['editable']=="true") @selected=row['cdata'] if rb.active? rb.signal_connect('toggled',row['cdata']){|me,cdata| if me.active? @selected=cdata edebug("#{self} changed to item #{selected}","form-combo","debug") pc.changed pc.notify_observers(self) run_events(item['id'],'form_item-Action') end } @widget.pack_start(rb) items[row['cdata']]=rb end end show_all if to_activate to_activate.toggled #emit the action to_activate.set_active(true) #set the default end run_events(item['id'],'form_item-AfterUpdate') end |