Class: PopupForm

Inherits:
Ruiby_gtk show all
Defined in:
lib/ruiby_gtk/editor.rb

Overview

Create a Form dialogue dialogue. @title: title of the dialog @w,h: default width/heiht of the dialog @data: data in grid : hash, must be an exemple (each field must hacve a value with good type) PopupForm.new(“Process”,0,0,{ “name” => “regis”, “last-name” => “aubarede”, “int” => 22 “float” => 22.333 },{ “Update” => proc {|w,data| data=“siger” ; w.set_data(data)}, “Abort” => proc {|w,data| w.destroy}, } ) { |hvalues| hvalues }

Constant Summary

Constants included from Ruiby_dsl

Ruiby_dsl::GTK2ICONNAME

Instance Method Summary collapse

Methods inherited from Ruiby_gtk

#chrome, #on_destroy, #on_resize, #rposition, #ruiby_exit, #set_window_icon

Methods included from Ruiby_threader

#after, #anim, #init_threader, #on_idle, #threader

Methods included from Ruiby_dsl

#_, #_accept?, #_cbox, #_check_append, #_create_log_window, #_dyn_check_button, #_dyn_entry, #_dyn_fslider, #_dyn_ientry, #_dyn_islider, #_dyn_label, #_dyn_progress, #_dyn_toggle_button, #_exe_posix, #_exe_windows, #_label, #_make_prop_line, #_nocodeeeeeeeeeee, #_pack, #_paned, #_radio_buttons, #_set_accepter, #_sub_image, #aaa_generalities, #accordion, #aitem, #alabel, #append_to, #apply_options, #attribs, #autoslot, #background, #backgroundi, #bourrage, #box, #button, #button_expand, #button_icon_text, #button_left_icon_text, #buttoni, #calendar, #canvas, #canvasOld, #cell, #cell_bottom, #cell_hspan, #cell_hspan_left, #cell_hspan_right, #cell_hvspan, #cell_left, #cell_pass, #cell_right, #cell_span, #cell_top, #cell_vspan, #cell_vspan_bottom, #cell_vspan_top, #center, #check_button, #clear, #clear_append_to, #clickable, #close_dialog, #color_choice, #color_conversion, #combo, #css_name, #current_layout, cv_color_html, #def_style, #delete, #dialog, #dialog_async, #entry, #exe, #fentry, #field, #fields, #flow, #flow_paned, #flowi, #force_update, #frame, #framei, #fslider, #get_config, #get_current_container, #get_icon, #get_image, #get_image_from, #get_pixbuf, #get_pixmap, #get_stockicon_pixbuf, #grid, #haccordion, #hide_app, #hradio_buttons, html_color, #html_color, #htoolbar, #htoolbar_with_icon_text, #ientry, #image, #install_composant, #islider, #label, #label_clickable, #labeli, #left, #levelbar, #list, #log, #log_as_widget, #menu, #menu_bar, #menu_button, #menu_checkbutton, #menu_separator, #next_row, #notebook, #on_canvas_button_motion, #on_canvas_button_press, #on_canvas_button_release, #on_canvas_draw, #on_canvas_key_press, #on_canvas_resize, #on_delete, #page, #panel, #panel_async, #panel_progress, #pclickable, #pclickablie, #plot, #popup, #popup_clear_append, #pp_item, #pp_separator, #progress, #progress_bar, #properties, #propertys, #razslot, #regular, #right, #row, #script, #scrolled, #sentence, #sentenci, #separator, #show_all_children, #show_app, #show_methods, #show_source, #slider, #slot, #slot_append_after, #slot_append_before, #sloti, #snapshot, #source_editor, #space, #spacei, #spacing, #stack, #stack_paned, #stacki, #syst_add_button, #syst_add_check, #syst_add_sepratator, #syst_icon, #syst_quit_button, #systray, #systray_setup, #table, #text_area, #text_area_dyn, #toggle_button, #toolbar_button, #toolbar_separator, #tooltip, #trace, #tree_grid, #var_box, #var_boxi, #vbox_scrolled, #video, #vradio_buttons, #widget_properties, #window

Methods included from Ruiby_default_dialog

#_gooooooooooo, #_process_terminal_key, #alert, #ask, #ask_color, #ask_dir_to_read, #ask_dir_to_write, #ask_file_to_read, #ask_file_to_write, #dialog_chooser, #edit, #error, #message, #prompt, #promptSync, #terminal, #trace

Constructor Details

#initialize(title, width = 350, height = 600, data = {}, options = {}, opt = {}, &bloc) ⇒ PopupForm

Returns a new instance of PopupForm.



115
116
117
118
119
120
121
122
123
# File 'lib/ruiby_gtk/editor.rb', line 115

def initialize(title,width=350,height=600,data={},options={},opt={},&bloc)
		@bloc= bloc 
		@data=data
		@options=options
		@popt=opt
		@options["button-direction"] ||= "h"
		@title=title
    super(title[0..50],width,height)
end

Instance Method Details

#button_listObject



138
139
140
141
142
143
# File 'lib/ruiby_gtk/editor.rb', line 138

def button_list()
	@options.each do |name,action| 
		next unless   action.respond_to?(:call)
		button(name) { action.call(@form,@form.get_data() )  rescue  error($!)  }
	end
end

#componentObject



127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ruiby_gtk/editor.rb', line 127

def component()
  stack do
	labeli(@title)
	@form=properties("",@data,@popt) { |a| @bloc.call(a) if @bloc }
	case @options["button-direction"] 
		when /^h/i then flowi  { button_list }
		when /^v/i then stacki { button_list }
	end
	sloti( button(" Exit ") { destroy() }) if @options.size==0
  end
end

#update(data) ⇒ Object



124
125
126
# File 'lib/ruiby_gtk/editor.rb', line 124

def update(data)
	@form.set_data(data)
end