New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better way to append child to a vbox #1180
Comments
We can simplify it like the following? radio = nil
@t.each do |name|
label = "#{name["city"]}, #{name["countryCode"]}"
if radio.nil?
radio = Gtk::RadioButton.new(label)
else
radio = Gtk::RadioButton.new(radio, label)
end
halign = Gtk::Alignment.new 0, 0, 0, 0 # left align everythin in result_box
halign.add radio
#######
# IS THERE A BETTER WAY TO ADD RESULTS TO A VBOX
@result_box.add halign
radio.show
halign.show
end But what do you want to avoid? |
This was more of a Gtk framework question, to see if there is a better way to add child to a parent. Since vbox was already created, I wanted to know if it is inefficient to modify boxes after they have been created. Also, did you try doing ctrl+c to close the app? It introduces a segmentation fault. At first I thought it was because of vbox, but later found the problem to be because of Notebook. Apparently adding notebook to dialogs introduces some low-level error, You can see that if you do ctrl+c in the terminal. |
Ctrl+C didn't cause a segumentation fault on my environment: % ruby /tmp/br.b
tk-Message: 21:33:46.653: Failed to load module "canberra-gtk-module"
^CTraceback (most recent call last):
1: from /tmp/b.rb:141:in `<main>'
/tmp/b.rb:141:in `main': Interrupt
% |
No response. |
Hey
I am trying to append children to a vbox after it has been created. That vbox is actually a child of a scrolled_window.
Basically after a search box receives the enter key signal, I want to add the results to the scrolled_window.
The way I have done, It works but I wonder if there is a better way?
Is their a better way?
EDIT - using gtk2
The text was updated successfully, but these errors were encountered: