How to refresh combobox when select a new file

I want to refresh the combobox when I choose a new files.

I used the “.clear” it will clear the combobox context, but I choose the
other file the combobox context just show nil (same as clear).

When I didn’t use the .clear the combobox context will stack up by each
file.

cb2_s.clear
cb2_i.clear

fop2 = File.open(label2.text)
text2 = fop2.readlines
header_2 = ppoc.call(text2[0])

m = 0
while header_2[m]!=nil

if header_2[m] =~Regexp.new(/game/)

cb2_s.prepend_text “#{header_2[m]}”
end

if header_2[m] =~Regexp.new(/name/)

cb2_i.prepend_text “#{header_2[m]}”
end
m+=1
end

cb2_s.signal_connect “changed” do |w, e|
on_changed(w, e, label)
label_2_s.text = label.tex
end

cb2_i.signal_connect “changed” do |w, e|
on_changed(w, e, label)
label_2_i.text = label.text
end

Thanks.

hi CC,

i would post this in the ‘Gnome 2’ section of the forum - that’s the
place for gtk2 questions. also, i would try to write a very simple
example that shows the problem you’re having - the code you provide is
obviously cut out of something that you have written, and is probably
very clear to you, but out of context it’s hard for anyone else to offer
any solutions. write something very very basic that provides an example
of the problem, and you’ll probably have better luck getting useful
advice…

  • j

jake kaiden wrote in post #1016907:

hi CC,

i would post this in the ‘Gnome 2’ section of the forum - that’s the
place for gtk2 questions. also, i would try to write a very simple
example that shows the problem you’re having - the code you provide is
obviously cut out of something that you have written, and is probably
very clear to you, but out of context it’s hard for anyone else to offer
any solutions. write something very very basic that provides an example
of the problem, and you’ll probably have better luck getting useful
advice…

  • j

Thanks.