Re: Using different signals depending on which row of of a treeview



This is more or less what I did except I added a signal_connect separately
to the visibilty (which is in a cell_data_function on first renderer)

ie: (perl)
my @cells=Treeview->get_column(n)->get_cells;
then
$cells[n]->signal_connect(blah
}
);
(where n is the appropriate number of column/renderer)





On Mon, 29 Apr 2019 at 22:57, Reuben Rissler <silrep emypeople net> wrote:



On 04/29/2019 10:36 AM, Mike Martin via gtk-app-devel-list wrote:
Has anyone done anything like this?
I haven't, but you are welcome to my simple Glade mockup:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkListStore" id="combo_model">
     <columns>
       <!-- column-name id -->
       <column type="gchararray"/>
       <!-- column-name text -->
       <column type="gchararray"/>
     </columns>
     <data>
       <row>
         <col id="0" translatable="yes">1</col>
         <col id="1" translatable="yes">one</col>
       </row>
       <row>
         <col id="0" translatable="yes">2</col>
         <col id="1" translatable="yes">two</col>
       </row>
       <row>
         <col id="0" translatable="yes">3</col>
         <col id="1" translatable="yes">three</col>
       </row>
     </data>
   </object>
   <object class="GtkListStore" id="tree_model">
     <columns>
       <!-- column-name text -->
       <column type="gchararray"/>
       <!-- column-name text_visible -->
       <column type="gboolean"/>
       <!-- column-name combo_visible -->
       <column type="gboolean"/>
       <!-- column-name toggle_visible -->
       <column type="gboolean"/>
     </columns>
     <data>
       <row>
         <col id="0" translatable="yes">text</col>
         <col id="1">True</col>
         <col id="2">False</col>
         <col id="3">False</col>
       </row>
       <row>
         <col id="0" translatable="yes">combo</col>
         <col id="1">False</col>
         <col id="2">True</col>
         <col id="3">False</col>
       </row>
       <row>
         <col id="0" translatable="yes">toggle</col>
         <col id="1">False</col>
         <col id="2">False</col>
         <col id="3">True</col>
       </row>
     </data>
   </object>
   <object class="GtkWindow">
     <property name="can_focus">False</property>
     <child>
       <placeholder/>
     </child>
     <child>
       <object class="GtkTreeView">
         <property name="visible">True</property>
         <property name="can_focus">True</property>
         <property name="model">tree_model</property>
         <child internal-child="selection">
           <object class="GtkTreeSelection"/>
         </child>
         <child>
           <object class="GtkTreeViewColumn">
             <property name="title" translatable="yes">column</property>
             <child>
               <object class="GtkCellRendererText">
                 <property name="editable">True</property>
               </object>
               <attributes>
                 <attribute name="visible">1</attribute>
                 <attribute name="text">0</attribute>
               </attributes>
             </child>
             <child>
               <object class="GtkCellRendererCombo">
                 <property name="editable">True</property>
                 <property name="model">combo_model</property>
                 <property name="text_column">1</property>
               </object>
               <attributes>
                 <attribute name="visible">2</attribute>
                 <attribute name="text">0</attribute>
               </attributes>
             </child>
             <child>
               <object class="GtkCellRendererToggle"/>
               <attributes>
                 <attribute name="visible">3</attribute>
                 <attribute name="active">3</attribute>
               </attributes>
             </child>
           </object>
         </child>
       </object>
     </child>
   </object>
</interface>

Basically the idea is that I push multiple renderers into a treeview
column
, then depending on the row hide/show the appropriate renderer (text,
combo, toggle)
So go ahead and add three different renderers, and use row values to set
them visible or invisible. In this case we have three different
column/row cells to set each widget visible.

Then call the appropriate signal_connect (edited, changed, toggled)
You can't really generate a signal on an invisible renderer, can you?
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]