The READIN Family Album
Me and Sylvia, walkin' down the line (May 2005)

READIN

Jeremy's journal

Let us not love with words or tongue but with actions and in truth.

I John 3:18


(This is a page from my archives)
Front page
More recent posts
Older posts

Archives index
Subscribe to RSS

This page renders best in Firefox (or Safari, or Chrome)

Thursday, February 17th, 2005

🦋 User Interface feature

When you have a list box that gets items added to it on a continuing basis over the course of a program, it is nice for the list box to scroll downwards as items are added, so the most recent one is always visible. Except when the user is involved in reading some older items -- then this behavior is very annoying. Here is a solution, as implemented in an MFC application -- pretty easy to translate to C/C++* -- other languages, you're on your own:

int GetVisibleCount(CListBox &lb)
{
    CRect rct;
    lb.GetWindowRect(&rct);
    int iHgt = lb.GetItemHeight(0);
    return (rct.bottom - rct.top) / iHgt;
}

    // handler for a custom "Add Item" message
LRESULT CMyDlg::OnAddItem(WPARAM wp, LPARAM lp)
{
    const char *msg   = (const char *) lp;

    int iTop = m_lbRealtimeStatus.GetTopIndex();

    m_lbStatus.AddString(msg);
        // "static" because I am never resizing the 
        // lb -- if you are you will need to calc 
        // this every time.
    static visibleCount = GetVisibleCount(m_lbStatus);
		
    if (iTop == m_lbStatus.GetCount() - 1 - visibleCount)
        m_lbStatus.SetTopIndex(iTop + 1);
    return 0L;
}

So what I am doing is, every time I add an item, I check what the current topmost visible index of the list box is -- if it is not equal to the number of items in the list box less the number of visible items, then I do not scroll. (Note that this calculation doesn't work when there are fewer items in the list box than the max number that will fit on the screen; but that does not matter because there is no need to scroll anyways in that situation.)


* That is to say, C or C++ where you are not using MFC classes.

posted afternoon of February 17th, 2005: Respond
➳ More posts about Programming

Wednesday, February 16th, 2005

The Phantom Tollbooth -- we read Chapter 9 tonight -- Sylvia is really enjoying the characters though I'm not sure how much of the plot she is getting. Details which captivate her: the sisters named Rhyme and Reason, which are not proper names like Sylvia or Emily; the dog mistakenly named Tock even though the sound he makes is tick-tick-tick; the box given by King Azaz to Milo, which contains all the words that will ever be used -- this last reminds me a bit of Borges' Library of Babel and I wonder whether Juster had that in mind.

posted evening of February 16th, 2005: Respond
➳ More posts about The Phantom Tollbooth

Friday, February 11th, 2005

The Phantom Tollbooth: Tonight we will read Chapter 6, the story of Rhyme and Reason as told by Faintly Macabre. Sylvia is maintaining interest in the story and remembers the characters and situations from day to day.

posted afternoon of February 11th, 2005: Respond
➳ More posts about Norton Juster

Thursday, February 10th, 2005

🦋 Gung He Fat Choy

Happy Year of the Rooster! Here are some pictures of Sylvia with friends Sasha, Kaydi, and Samantha, at the FCC new year's party.

posted evening of February 10th, 2005: Respond
➳ More posts about Sylvia

Sunday, February 6th, 2005

🦋 Chapter book

Sylvia has recently gotten interested in the idea of reading chapter books. This is good news for me because I am interested in reading chapter books with her. The first one we read, last week, was a not very well-written or thought-out book about two children who discover a magical tree-house that enables them to travel back in time, apparently part of a series, this one has them go back to prehistory and interact with dinosaurs.

On Friday I bought Norton Juster's The Phantom Tollboth, which is one of my favorite books from my own childhood. I was not sure whether Sylvia was quite ready for it but figured it was worth a try. And it seems to have been a good choice -- we have read 2 chapters so far and she is paying very close attention.

Paying attention is a major topic of the book and I am having the feeling while reading it, that I should have taken it more to heart when I read it as a boy; or that I should have reread it around the time I started to forget it, in my early twenties. Not paying sufficient attention is a big part of what I have been doing wrong in the past ten or so years. Seems like it should be easy enough to change back... Hoping my facility to pay attention has not atrophied from neglect.

posted evening of February 6th, 2005: Respond
➳ More posts about Readings

Saturday, February 5th, 2005

A month ago I posted the story of a glue-up gone wrong. Today I glued up a second similar cabinet and thanks to input from the gang at WoodCentral, it went much better. The key difference: as advised by William Duffield, I did not put the backer boards in slots, but instead cut a rabbett and will nail them in place after the frame is dry. This means in the glue-up, I only have to worry about four boards instead of ten, much more reasonable. Also I thought through my clamping beforehand, so it was easy to get everything put together once the glue was on; and I made pinch sticks to measure the diagonals of the cabinet. I think these will be my most successful dovetails to date, which is not saying too much but is a good feeling anyways.

posted evening of February 5th, 2005: Respond
➳ More posts about Sylvia's room

🦋 Movie Night

We watched the second half of Fantasia tonight, except for A Night on Bald Mountain which Sylvia found too scary. (And she was pretty tired anyway by that point.) Weird -- I was totally sure that Peter and the Wolf was one of the songs in Fantasia, but apparently not.

posted evening of February 5th, 2005: Respond
➳ More posts about Family Movie Night

Friday, February 4th, 2005

🦋 Movie Night

Been a while since I posted about a family movie night and we have had a few more in the mean time. Tonight we watched the first half of Fantasia and that was a lot of fun. Sylvia was quite chatty throughout -- the Toccata and Fugue in D Minor played against a background of Sylvia talking about how she had watched part of this movie in school after lunch and calling various images "funny", "good" or "sad"; The Nutcracker was accompanied by her memories of seeing it performed at NJPAC; The Rite of Spring had a lot of dinosaur-related commentary and (my personal favorite) during the first 30 seconds or so, when the screen is dark and there is no sound: "'s it over?..." "What's happening?..." "Maybe it's loading."

The commentary did not stem from being bored with the movie but from being engaged. She was particularly keyed-up about The Rite of Spring and busy naming all the dinosaurs that appeared on screen. She got that the large meat-eating dinosaur had to be an Allosaurus because it had three fingers and was attacking a Stegosaurus. (I think maybe there was some confusion at the studio though, and they intended Tyrannosaurus -- there were definitely some Cretaceous creatures in the crowd that looked up in alarm at the predator.)

posted evening of February 4th, 2005: Respond
➳ More posts about The Movies

Sunday, January 30th, 2005

The wall unit for Sylvia's room is coming along nicely (though I expect to be done in March now, not February) -- tonight while I was cutting dovetails for the remaining section of it, Ellen and Sylvia were painting one of the completed sections.

Sylvia and I went over to Mark's house today, where Christine and Bill also came to visit. We had a great time, including watching Harold Lloyd movies and learning from Bill how to play "Just Like Tom Thumb's Blues".

posted evening of January 30th, 2005: Respond
➳ More posts about Home improvement

Thursday, January 27th, 2005

🦋 Nathan Zuckerman is a Better Writer than Philip Roth

Hey, anyone want to talk about Roth? I'm reading American Pastoral right now and really enjoying it.

posted afternoon of January 27th, 2005: Respond
➳ More posts about American Pastoral

Previous posts
Archives

Drop me a line! or, sign my Guestbook.
    •
Check out Ellen's writing at Patch.com.

Where to go from here...

Friends and Family
Programming
Texts
Music
Woodworking
Comix
Blogs
South Orange