class MyRendererRadioGroup
this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
Attributes
first[RW]
items[RW]
pc[RW]
selected[RW]
Public Class Methods
new(pc)
click to toggle source
Calls superclass method
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 7 def initialize(pc) super() set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC) add_with_viewport(@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
Public Instance Methods
inspect()
click to toggle source
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 76 def inspect "RadioGroup(#{item["description"]})" end
item()
click to toggle source
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 70 def item pc.item end
parentM()
click to toggle source
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 67 def parentM pc.parentM end
text()
click to toggle source
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 73 def text selected end
to_s()
click to toggle source
# File lib/FormHolder/Form/InputHolder/RadioGroup.rb, line 79 def to_s;inspect;end
update(new_value=item['default'])
click to toggle source
# 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