Wednesday, August 28, 2024

More on internal links in the blog manager

I apologise in advance about continually writing about my blog entry manager program. Unfortunately or otherwise, this is what is currently occupying a great deal of my mental space (instead of writing lyrics) and I seem to have new ideas every day.

I wrote1 the other day about including internal links in my blog so I can easily find blogs referenced within the daily entries. The code that parses the links is rather ad hoc but seems to do the work. I also developed a system for adding internal links to old blogs, which at the moment of course constitute a vast majority. In order to display an internally linked blog, I would have to press on the system menu and choose 'internal links' that brings up a dialog with a list of the linked blogs. Clicking on one of the lines causes the chosen blog to be displayed.

Today I had the idea of displaying an internally linked blog from within the 'show entry' window. My original idea was to do this by means of key clicks such as Alt-1, Alt-2, etc, but it seems that the web browser swallows these key clicks as the handler that I added didn't see them. Then I tried adding tool buttons or speed buttons on a panel, but these solutions, whilst feasible, caused display problems. Then I remembered a trick that I've already used in this program: adding the blog titles to a status bar2 (as shown below).


When the 'show entry' window is displayed, a simple query iterates over the referenced blogs and adds them to the status bar. I would like to do this dynamically but at the moment I have yet to find code that shows how to do this. I may add the reference number to the text, and now it occurs to me that maybe I can adjust each panel's width to show the entire text - in other words, prevent the title 'Neat hack - but is it useful? (Management program)' from being truncated, whilst not allowing any space after 'redesigning the 'blogs' program'. That can wait for another day. Even so, using the status bar saves at least one click of the mouse, and as I tell people at work, I get paid by the number of clicks that I save people (this is a joke as I hasten to point out to those people).

Of course, five minutes after having written the above paragraph, I found code that allows me to add the panels dynamically. I also found code to set the width according to the text to be displayed but that code doesn't quite get the width correct, so I'm adding on an extra 18% as shown below (18% is the increment that I determined after testing).

with qGetInternals do begin params[0].asinteger:= blog; open; while not eof do begin newpanel:= sb.panels.add; newpanel.text:= fields[0].asstring + '-' + fields[1].asstring; newpanel.width:= (sb.canvas.textwidth (newpanel.text) * 118) div 100; next; end; close end;

Internal links
[1] 1808
[2] 1602



This day in history:

Blog #
Date
Title Tags
193 28/08/2009
Firebird date fields, continued Programming, Firebird, dbExpress
503 28/08/2012
Disappointing blood test results Health
621 28/08/2013
Nothing more MIDI, Sandy Denny
1333 28/08/2020
Time sheets and perceived value ERP, DBA, Organisation behaviour

No comments: