FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is gtk.builder fully implemented?

 
Post new topic   Reply to topic     Forum Index -> gtkD
View previous topic :: View next topic  
Author Message
danielking



Joined: 06 Dec 2008
Posts: 6

PostPosted: Sun Dec 14, 2008 8:34 pm    Post subject: Is gtk.builder fully implemented? Reply with quote

test.d
Code:
module gtk.HelloWorld;

import tango.io.Stdout;
import gtk.Main;
import gtk.Window;
import gtk.Widget;
import gtk.Button;
import gtk.Builder;

class MainWindow
{
    Builder b;
    Window w;
   this()
   {
      b = new Builder();
      if(b)
      {
                        b.addFromFile("test.xml");
      }
   }
}

void main(string[] args)
{
   Main.init(args);
   new MainWindow();
   Main.run();
}


test.xml:
Code:
<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.12"/>
  <object class="GtkWindow" id="wnd">
    <property name="width_request">400</property>
    <property name="height_request">300</property>
    <property name="window_position">GTK_WIN_POS_CENTER</property>
    <property name="default_width">400</property>
    <property name="default_height">300</property>
    <child>
      <object class="GtkVBox" id="vbox">
        <property name="visible">True</property>
        <child>
          <object class="GtkToolbar" id="toolbar">
            <property name="visible">True</property>
            <property name="icon_size">GTK_ICON_SIZE_MENU</property>
            <child>
              <object class="GtkToolButton" id="tb_note_new">
                <property name="visible">True</property>
                <property name="stock_id">gtk-new</property>
                <signal name="clicked" handler="on_tb_note_new_clicked"/>
              </object>
              <packing>
                <property name="homogeneous">True</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
          </packing>
        </child>
        <child>
          <object class="GtkHPaned" id="hpaned">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <child>
              <object class="GtkTreeView" id="tv_tags">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="resize">False</property>
                <property name="shrink">True</property>
              </packing>
            </child>
            <child>
              <object class="GtkTreeView" id="tv_notes">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="resize">True</property>
                <property name="shrink">True</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
  </object>
</interface>



It's compiled successfully, but throw an exception at runtime.
Code:
glib.GException.GException: Invalid object type `GtkVBox'
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Mon Dec 15, 2008 3:07 pm    Post subject: Reply with quote

the builder classes are not fully implemented, but what you are doing should work. The Error you are seeing is the one returned by gtk.
Back to top
View user's profile Send private message
danielking



Joined: 06 Dec 2008
Posts: 6

PostPosted: Mon Dec 15, 2008 6:10 pm    Post subject: Reply with quote

Mike Wey wrote:
the builder classes are not fully implemented, but what you are doing should work. The Error you are seeing is the one returned by gtk.


But I use the same xml file with a program written in c language, and it works.
Back to top
View user's profile Send private message
Mike Wey



Joined: 07 May 2007
Posts: 428

PostPosted: Thu Dec 18, 2008 1:21 pm    Post subject: Reply with quote

Odd, since GtkD only passes the filename to gtk.
Back to top
View user's profile Send private message
bkropf



Joined: 28 Oct 2008
Posts: 6

PostPosted: Mon Dec 22, 2008 3:51 am    Post subject: Reply with quote

It seems I was able to get the provided example to build and run with no errors by adding the following (pulled from a question on another mailing list http://markmail.org/message/x6lavzyivqqk7n2i):

Code:
void main(string[] args) {
   Main.init(args);
   
   scope Window w = new Window("fake");
   scope VBox v = new VBox(1, 1);
   scope Toolbar t = new Toolbar();
   scope ToolButton tb = new ToolButton("open");
   scope HPaned hp = new HPaned();
   scope TreeView tv = new TreeView();
   
   new MainWindow();
   Main.run();
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> gtkD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group