> From: Sherlock, Ric
> Sent: Wednesday, 9 June 2010 18:52
> 
> Thanks, yes that works fine!
> Downloading Glade now to have a look.
> 
> > From: bill lam
> > Sent: Wednesday, 9 June 2010 16:25
> >
> > You may also put a + in the cd signature for windows.
> >
> > Срд, 09 Июн 2010, bill lam писал(а):
> > > Ric,
> > >
> > > As you already noticed, glade was considered but it has not yet
> > > materialized into any concrete scripts inside addons. Here is a
> very
> > > simple demo.  This demo does not process any event yet.  Amend the
> > > pathname F and load 't1.ijs' to test. You may try some other forms
> > > created from glade3 to test.

I haven't read any documentation yet but was able to create the following 
dialog using Glade and display it with the associated minor changes to your 
script. The size of the xml code is verbose relative to the previous wd code, 
but I suppose that's the price you pay for extra functionality!

NB.-------t2glade.ijs------------------------------------
require 'gui/gtk'
coinsert 'jgtk'

gtk_builder_connect_signals=: ((>libgtk), ' gtk_builder_connect_signals >+ n x 
x')&cd

F=: jpath '~temp/t2glade.glade'
smoutput 'file size: ',":$1!:1 <F

3 : 0''
if. -.IFGTK do. gtkinit'' end.
builder=: gtk_builder_new''
smoutput 'builder: ',":builder
gtk_builder_add_from_file builder;F;,0

window=: gtk_builder_get_object builder;'dialog1'
smoutput 'window: ',":window

gtk_builder_connect_signals builder;0
g_object_unref builder
gtk_widget_show window
if. -.IFGTK do. gtk_main'' end.
)

NB.-------t2glade.glade-----------------------------------

<?xml version="1.0"?>
<interface>
  <requires lib="gtk+" version="2.16"/>
  <!-- interface-naming-policy project-wide -->
  <object class="GtkDialog" id="dialog1">
    <property name="border_width">5</property>
    <property name="type_hint">normal</property>
    <property name="has_separator">False</property>
    <child internal-child="vbox">
      <object class="GtkVBox" id="dialog-vbox1">
        <property name="visible">True</property>
        <property name="orientation">vertical</property>
        <property name="spacing">2</property>
        <child>
          <object class="GtkCalendar" id="calendar1">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="year">2010</property>
            <property name="month">5</property>
            <property name="day">9</property>
          </object>
          <packing>
            <property name="position">1</property>
          </packing>
        </child>
        <child internal-child="action_area">
          <object class="GtkHButtonBox" id="dialog-action_area1">
            <property name="visible">True</property>
            <property name="layout_style">end</property>
            <child>
              <object class="GtkButton" id="button1">
                <property name="label">gtk-apply</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="tooltip_markup">Button with image?</property>
                <property name="use_stock">True</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">False</property>
                <property name="position">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton" id="button2">
                <property name="label" translatable="yes">Ric's 
button</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <property name="tooltip_markup">Button doesn't do 
anything</property>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">False</property>
                <property name="position">1</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="pack_type">end</property>
            <property name="position">0</property>
          </packing>
        </child>
      </object>
    </child>
    <action-widgets>
      <action-widget response="0">button1</action-widget>
      <action-widget response="0">button2</action-widget>
    </action-widgets>
  </object>
</interface>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to