heey, i have a problem with my script could some one please look at it
and tell me why my search button and list button doesn't work!!
here is my script:
Shoes.app :title => "PPID", :height => 400, :width => 700 do
background black, :height => 60
background gradient(rgb(1.0, 1.0, 1.0, 0.7), rgb(1.0, 1.0, 1.0, 0.0))
title "PPID", :align => "center", :stroke => white
caption "Personal: Person Info Database", :top => 80, :left => 20
stack :top => 85, :left => 380 do
flow do
name = edit_line :width => 150
button "Search" do
ds = SomeDataProcessing.openOn("PPIDdata.txt")
ds.showData(name.text)
end
button "List" do
dl = SomeDataProcessing.openOn("PPIDdata.txt")
dl.listData
end
end
end
#< between here there is a other part of the script but that is working
class SomeDataProcessing
Person = Struct.new :name, :last_name, :phone_number, :birthday,
:city, :adress
def self.openOn(p_file)
new(p_file)
end
def initialize(p_file)
@file = p_file
@persons = {}
loadData
end
def listData
@persons.keys.sort.each {|p| showlistData(p)}
end
def loadData
File.foreach(@file) do |line|
name, last_name, phone_number, birthday, city, adress =
line.chomp.split(",")
@persons[name] = Person.new(name, last_name, phone_number,
birthday, city, adress)
end
end
def showData(p_name)
person = @persons[p_name]
if person.nil?
then
@show_text2 = "#{p_name} not in database."
end
stack do
@show_text2 = "Name: #{person.name} #{person.last_name}"
"Phonenumber: #{person.phone_number}"
"Birthday: #{person.birthday}"
"City: #{person.city}"
"Adress: #{person.adress}"
end
edit_box @show_text2, :width => 250, :height => 200, :top => 140,
:left => 380
end
def showlistData(p_name)
person = @persons[p_name]
if person.nil?
then
@show_text3 = "#{p_name} not in database."
end
@show_text3 = "#{person.name} #{person.last_name}"
edit_box @show_text3, :width => 250, :height => 200, :top => 140,
:left => 380
end
end
end
···
--
Posted via http://www.ruby-forum.com/\.