[Vala] [VALA] Problem with textview (it resize automatically...)
- From: raum no-log org
- To: vala-list gnome org
- Subject: [Vala] [VALA] Problem with textview (it resize automatically...)
- Date: Thu, 18 Oct 2012 15:07:16 +0200
Hi,
I've got a problem with Gtk 3 / Glade... When I add too much lines in my
textview, it gets bigger and recovers the other widgets of my window !
Below, you could see my code... Where am I wrong ? Any advice ??
thanks
Regards
------------------------------ TEST4.VALA ---------------------------
using Gtk;
class TestApp : Gtk.ApplicationWindow {
const string UI = "test.ui";
public Window main_window;
public TextView tview;
public TextBuffer buffer;
public TestApp() {
Builder builder = new Builder();
builder.add_from_file(UI);
main_window = builder.get_object("window1") as Window;
main_window.destroy.connect(Gtk.main_quit);
builder.connect_signals(this);
tview = builder.get_object("textview1") as Gtk.TextView;
buffer = tview.get_buffer();
for (int i = 0; i < 25; i++)
buffer.text += "test " + i.to_string() + "\n";
}
[CCode (cname = "G_MODULE_EXPORT on_start")]
public void on_start(Button source){
var messagedialog = new Gtk.MessageDialog (main_window,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.WARNING,
Gtk.ButtonsType.OK_CANCEL,
"This action will cause the universe to stop
existing.");
if (messagedialog.run() == ResponseType.OK) {
stdout.printf ("tata\r\n");
messagedialog.destroy();
}
}
}
void main(string[] args) {
Gtk.init (ref args);
TestApp h = new TestApp();
h.main_window.show_all();
Gtk.main();
}
---------------------------- TEST.UI ----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">600</property>
<property name="height_request">400</property>
<property name="can_focus">False</property>
<property name="resizable">False</property>
<child>
<object class="GtkLayout" id="layout1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="start">
<property name="label" translatable="yes">button</property>
<property name="width_request">119</property>
<property name="height_request">32</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image_position">top</property>
<signal name="clicked" handler="on_start" swapped="no"/>
</object>
<packing>
<property name="x">15</property>
<property name="y">360</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="textview1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="width_request">450</property>
<property name="height_request">300</property>
</object>
<packing>
<property name="x">15</property>
<property name="y">16</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]