GTK list box won't refresh...?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

GTK list box won't refresh...?

#1 Post by sunburnt »

I'm making a GTK tab (NoteBook) panel builder tool.
The button pops up a path chooser to select a path to GTK files &
writes the path to a file, then refreshes an entrybox & a listbox from that file.
The entrybox refreshes, but the listbox does not, the same methods are used for both.
The listbox reads it's file when the app. is run, but not when it's refreshed.
The clear action command works as the listbox is cleared, but it's not refreshed.

This is a short version of the GTK code:

Code: Select all

export GTK_Tool='
<vbox>
  <frame Path to GTK panel files>
  <hbox>
  <entry>
   <variable>Path</variable>
   <input>cat ./gtk-tab-tool.path</input>
  </entry>
  <button>
   <label>Pick Path</label>
   <action>./gtk-tab-tool getpath \$Path</action>
   <action clear>Path</action>
   <action>refresh:Path</action>
   <action clear>List</action>
   <action>refresh:List</action>
  </button>
  </hbox>
  </frame>

  <hbox>
  <frame New GTK file configuration>
  <list>
    <variable>List</variable>
    <input>cat ./gtk-tab-tool.cfg</input>
    <action>echo You selected $List</action>
  </list>
  </frame>
    <frame NEW GTK file control>
    <entry>
     <variable>Name</variable>
    </entry>
    <text><label>Name of NEW GTK file</label></text>
    <button>
     <label>Write GTK File</label>
     <action>./gtk-tab-tool -c \$Name</action>
     <action clear>List</action>
     <action>refresh:List</action>
    </button>
    <button>
     <label>Show GTK File</label>
     <action>./gtk-tab-tool showgtk \$Name</action>
     <action clear>List</action>
     <action>refresh:List</action>
    </button>
    </frame>
  </hbox>
</vbox>
'
gtkdialog --program=GTK_Tool


User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

a bit difficult to reproduce, as your additional scripts miss.

I'll attach a modified example, that seems to update the list.

Mark
Attachments
gtklistboxtest-gtktabtool.tar.gz
(690 Bytes) Downloaded 247 times

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#3 Post by sunburnt »

Sorry about the abridged version, I definately should have explained more...
I really didn't want someone else having to wade through my full code though.

The "Pick Path" button's action code calls a dir. chooser control "Xdialog -deselect",
& writes the chosen ${Path} to the file: ./gtk-tab-tool.path for the entrybox.
The action code then writes the names of all files in that path
of the type "*.gtk" to the file: ./gtk-tab-tool.cfg for the listbox.
ls -1 ${Path}*.gtk |sed 's/\.gtk$//' |sed 's/^.*\///' > ${Path}gtk-tab-tool.cfg

The buttons "clear & refresh" commands should then force the listbox to reread that file.
The other button's actions below should refresh the listbox also (of course).

As I said, the entrybox refresh works: <input>cat ./gtk-tab-tool.path</input>
But not the listbox: <input>cat ./gtk-tab-tool.cfg</input>
And as I said, the file: ./gtk-tab-tool.cfg has the correct list of files in it.

I tried using the file: ./gtk-tab-tool.cfg as a script as you did, but still nada...
Same thing, it works at startup, but the button's refresh doesn't effect the listbox.
But the listbox should be empty at startup, so it reading a list is preferred.

I'm really baffled as to why the listbox when refreshed
won't read the text file for input the same as the entrybox does.
But if the file: ./gtk-tab-tool.cfg isn't empty at startup it does read it.

This is typical of how most of my time is spent, not writing/debugging code,
but trying to debug the manner in which GTK widgets operate.

Thanks for your help Mark...
I'm not sure spending much time on this is worth it as the new GTK doesn't work the same way anyway.
So what I write using GTK won't be usable for anything else, as in it won't be portable
to newer Puppy versions or other Linux distros unless they have the same GTK version installed.
Boy! That's a real wet blanket on any enthusiasm for writing code with GTK!
I guess what I need is info on how to use widget sets directly without GTK.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#4 Post by sunburnt »

I reduced it to the 2 main widgets & the file: gtk-tab-tool.cfg read by the ListBox.
The file: gtk-tab-tool.cfg can have anything in it, the ListBox displays it's contense at startup,
but when the button's clicked it only clears the ListBox & doesn't refresh it.

Code: Select all

#!/bin/bash
export GTK_Tool='
  <vbox>
  <list>
    <variable>List</variable>
    <input>cat ./gtk-tab-tool.cfg</input>
  </list>
  <button>
   <label>Pick Path</label>
   <action clear>List</action>
   <action>refresh:List</action>
  </button>
  </vbox>
'
gtkdialog --program=GTK_Tool


User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

if I run your program (the old one too) I get:
** ERROR **: gtkdialog: Error in line 9, near token '>': syntax error
If I replace
gtkdialog --program=GTK_Tool
with
gtkdialog2 --program=GTK_Tool

it works.
Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#6 Post by sunburnt »

Dang it!
I've done that on sooooo many GTK files, & on this one I just completely missed it!

Needless to say it works great now...

Many thanks Mark, I'll post the GTK TabBox builder once I've tested it.

Post Reply