Revising card shape and initialization in WebCard

In NoteCards, Text cards are rectangular windows with proportions similar to a post-it note. The Web card type of WebCard inherits from Text, including the default window size. Since a Web card needs only display a URL, the default shape leaves most of the text area blank.

To make Web cards better fit the text area and visually differentiate them from cards of other types I reduced the default height to slighly less than half. The text of a Web card now has enough vertical space for three lines of a wrapped URL. The change makes Web cards closer to badges or tags with a URL as a label than a textual note.

To see the result compare the Web card at the top with the Text card a the bottom:

A Web (top) and a Text card (bottom) in WebCard.

I made other changes to WebCard, some of which related to the new card shape. First, the WCD.UpdateCardText function now scrolls the card window back to the top to ensure the initial portion of the URL is always in view.

Next, I modified WCD.ValidURLP to check that the lenght of the input URL doesn't exceed 255 characters, the maximum a card property can hold.

Finally, I completed the initialization of Web cards in WCD.MakeWebCard to handle cards that are not immediately displayed upon creation. This is the case of a Web card created via the NoteCards API when the nodisplayflg parameter of NCP.CreateCard is non NIL, instead of interactively by the user. I factored out the code common to displayed and undisplayed cards into the separate function WCD.InitCard.

It took me longer than expected to understand the initialization flow of undisplayed cards. My early attempts produced errors about a missing TEdit window as I unknowingly skipped the initialization of the parent Text type. Calling the parent constructor resolved the issue.

#WebCard #Interlisp #Lisp

Discuss... Email | Reply @amoroso@fosstodon.org