So Far, So Good
じゃね
Old Geek
じゃまた
It Was late, and I was tired.
As you can see, it has changed. It is still not complete, but I wanted a change.
It's looked the same since I first put it up in 2006.
So, I guess it was time.
じゃまた
So Far, So Good
じゃね
Canoe....
I was awfully tempted to take a canoe out for a spin, it would have
been the first time since 1992....
And unfortunately, my canoe paddling partner passed on last year. :(
Have to teach my wife to paddle....
じゃまた
Adendum
Bah
じゃまた
Incomplete Documentation and examples
Lack of knowledge?
A cruel streak?
I am finding lately that developers and those who
write tutorials, example code and books, do a very
poor job of complete examples.
Why?
For example: I am working on a project in which
I am trying to use GtkIconFactory, not bad in and
of itself, but the sample code I have seen takes
you to the point where you can get the menubar
visible, but no one (and I mean NO ONE) who
writes example code either on the net, or in books,
shows you how to actually take it to the next step
and make those really pretty buttons you just
created actually do something, at least without
segfaulting....
Bah
ではまた
Wow - 8 Months
Got a few things planned and up my sleeve.
---
1) Got a small programming project going on
2) Got a complex software installation happening - which I want
to make a how-to for, as none of the how-to's for this package
are terribly complete.
Stay tuned. ;)
ではまた
Programming - part 1: Gtktables
the large number of blogs from last year) I decided to blog again,
And I also decided, after not having done so in a serious (more or less)
manner for several years, to work on a programming project,
and maybe actually get it doing what I wanted to, in other words, finish it.
I am a Linux geek, so I am using the Gnome and Gtk
libraries to create my masterpiece ( :) ).
I program in c mostly, when I am programming
large projects.
One of the problems I ran accross was understanding tables.
Consider this actual c source code:
GtkWidget * table;
table = gtk_table_new(5,3,FALSE);
This is easy enough to understand: in simple terms, make a table called
(strangely enough) table. It is to be 5 rows high and 3 columns wide,
the "FALSE" indicates that it is to be "not homogeneous" (cells won't
have their size set by the size of the largest element contained in the
table).
Easy
BUT
The table documentation and all the tutorials I could find (two tutorials)
were driving me batty. Determining how to place widgets/text/whatever
in specific cells was, confusing, to say the least.
Here is an example attach command:
gtk_table_attach(GTK_TABLE(table),label,1,2,1,2,GTK_FILL,
GTK_FILL,0,0);
OK - what did it mean??
First of all, the gtk_table_attach command places an item in a table cell.
Here is how the docs described it:
void gtk_table_attach (GtkTable *table,GtkWidget *child,guint left_attach,guint right_attach,guint top_attach,guint bottom_attach,GtkAttachOptions xoptions,GtkAttachOptions yoptions,guint xpadding,guint ypadding);
The docs followed with a simple example:To make a button occupy the lower right cell of a 2x2 table, use
1 2 3 4 5 |
gtk_table_attach (table, button, 1, 2, // left, right attach 1, 2, // top, bottom attach xoptions, yoptions, xpadding, ypadding);
HUH???
|
To my tired mind, the instructions were a little hazy.
The actual confusing bits were:
guint left_attach,guint right_attach,guint top_attach,guint bottom_attach,
For anyone else running into this, here is how I eventually came to
understand it. Consider this table:
3 columns wide.
5 rows high.
Notice, I have placed a
number at the end of each
dividing line, both vertically
and horizontally.
With example placements in each cell. (Tables in gtk are
always numbered starting at zero.)
Notice the repeating number patterns?
So, taking the number in the first cell on the top left as an example,
the first digit (0) represents the first vertical line on the left side of
the cell. The second digit (1) represents the first vertical line on the
right side of the cell.
OK so far?
The third digit (0) represents the line on the top of the cell.
The fourth digit (1) represents the line on the bottom of the cell.
Therefore this:
gtk_table_attach(GTK_TABLE(table),label,1,2,1,2,GTK_FILL,
GTK_FILL,0,0);
means place a label into the table cell second from the left and second from
the top. To place an object (widget/text/whatever) in the very first cell
top row, top left the attach command would look like this:
gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,GTK_FILL,
GTK_FILL,0,0);
Hope that saves someone a bit of time.
じゃまた
History
(Often attributed to Mark Twain) I certainly
find it interesting, at least:
History does not repeat itself, but it does rhyme.
じゃまた