# Example of modifying the type_prompter to use # the unique_choice_lister. To keep it simple no additional messages are # defined. # Note that this is version 3.0.0.SP code. # Changes or additions to code are bracketed by the following lines: # **** BEGIN CHANGES **** # ***** END CHANGES ***** _method type_prompter.activate_in(frame) ## The activate in method which places the buttons ready for ## the prompter to be displayed on screen. FRAME is the frame ## which the prompter is to be put inside. .top_frame << frame p << panel.new( frame ) field_size << _self.field_size(.field_desc) .text_items << rope.new() label << label_item.new(p,_self.message(:value)) _for foo _over 1.upto(field_size) _loop item << .text_items.add(text_item.new(p, "", :model,_self, :display_length,20, :change_selector,:ok|()|, :help_id, :value_help)) item.set_right_of(label) p.start_row() _endloop _if .undo_button? _then button_item.new( p,_self.message(:undo), _self, :|undo()| ,:help_id, :undo_help) _endif # **** BEGIN CHANGES **** # if .field_desc is a dd_phys_field or dd_derived_field, and # field_size = 1 (I don't know how to deal with it otherwise), # add a button enabling a unique_choice_lister # (modify as needed if appropriate messages are added) f << .field_desc.class_name _if (f _is :dd_phys_field _or f _is :dd_derived_field) _and field_size = 1 _then button_item.new(p, "Pick...", _self, :|pick()|) _endif # ***** END CHANGES ***** button_item.new( p,_self.message(:ok), _self, :|ok()| ,:help_id, :ok_help) button_item.new( p,_self.message(:quit), _self, :|suspend()|,:help_id,:cancel_help ) >> _self _endmethod $ # **** BEGIN CHANGES **** _method type_prompter.pick() f << .field_desc c << unique_choice_lister.new() c.activate_on(f,_self,:set_pick_value|()|) _endmethod _method type_prompter.set_pick_value(v) t << .text_items[1] t.value << v.write_string _endmethod # ***** END CHANGES *****