Wednesday, August 26, 2015

Southwest Fox/Soutwest Xbase++ 2015 Deadline Approaches

Simple, quick reminder: the Early-bird registration deadline is this Monday, August 31st. We would hate to see you lose out on the $50 discount.

If you still need to register, please head over to the registration Web site today: http://geekgatherings.com/Registration

Every registered attendee gets admission and white papers to all regular conference sessions. Don't miss this chance to learn from the best and mix with your peers.

Only 50 days until we gather in Gilbert.

Wednesday, August 19, 2015

Changing Windows 10 Title Bar Colors

In Windows versions prior to 10, the color of window title bars is determined by what theme you’re using. In Windows 10, most applications have a white title bar. It doesn’t matter to me much what color they are, but since I’ve upgraded to Windows 10 and I’m updating the documentation for Stonefield Query as we get ready to release version 5.2, the screen shots I’ve taken for updated forms don’t match the existing screen shots for forms that weren’t changed. I have a few choices:

  • Ignore it, because who else but me will notice? Unfortunately, I’m too anal to take this approach.
  • Redo all screen shots. A cool feature of the Stonefield Query SDK is that it automates the taking of screen shots for about 50% of the dialogs. The reason for that feature is that Stonefield Query is highly configurable and some of the configuration settings affect the appearance of many forms. To make the documentation for a customized version of Stonefield Query match what the user sees, we have a function that regenerates the help, including running the app and automatically taking shots of any such forms. Unfortunately, that still leaves 50% of the forms I’d have to do manually. Life is too short.
  • Somehow change the title bars of the updated forms to use the same color as the existing screen shots.

I wasn’t sure the latter was possible but fortunately came across a blog post by Daniel Rubino that explains how to do it. One thing he doesn’t explain is how to select the desired color for the title bars. To do that, right-click the desktop, choose Personalize, select Colors, turn off Automatically pick an accent color from my background, and select the desired color from the palette that appears.

Monday, August 10, 2015

Southwest Fox News

Bad news and good news. First, the bad: Cathy Pountney had to pull out of speaking at Southwest Fox this year due to a heavy work load. The good news: Tuvia Vinitsky, who’s spoken at Southwest Fox several times, has agreed to take her place. I doubt he’ll be bringing as many shoes as Cathy usually does, but he will be bringing his A-game with two very interesting sessions: dbSchema: SQL Server Database Design and Maintenance Made Easy and PCI Compliance: Facts and Fear. Thanks for stepping up, Tuvia!

Also, a reminder that the September 1 early bird deadline is less than a month away. Sign up today to save $50.

Monday, July 06, 2015

Southwest Fox/Southwest Xbase++ 2015 Are a Go!

I’m delighted to tell you that Rick, Tamar, and I met (via Skype) and made the decision to move forward with this year's conferences. Registrations to date are almost identical to last year's on the same date, giving us confidence that the conferences remain financially feasible.

We're also happy to tell you that we've added Rick Borup to the speaker list. I’m especially looking forward to his Version Control Faceoff: Git vs Mercurial session, because while I use Mercurial daily, I’m not that familiar with Git.

See you in October!

Wednesday, June 24, 2015

Southwest Fox 2015 Super-Saver Deadline Approaches

The countdown clock is ticking! The Super-Saver deadline for Southwest Fox and Southwest Xbase++ 2015 is June 30th, less than a week away. We still need people to register to make the conferences happen.

The conferences take place October 15-18, 2015 in Gilbert, Arizona and we really hope you can be there. We would hate to see you miss out on the $125 discount, the FREE pre-conference session, and an opportunity to win a scholarship or a license of Stonefield Query SDK (a $6,000 value).

After checking out our list of amazing speakers and digging into our session tracks for VFP and Xbase++, head over to the registration Web site today: http://geekgatherings.com/Registration.

Friday, June 12, 2015

Listen to the FoxShow #80

Andrew MacNeill posted the latest version of the FoxShow featuring an interview with Rick, Tamar, and I about Southwest Fox and Southwest Xbase++ 2015.

Wednesday, June 10, 2015

Displaying Balloon Tips with Listboxes

Stonefield Query makes it very simple to create a report: select the fields you want, set the properties of those fields as necessary, and click Preview to run the report. However, sometimes it’s hard to tell exactly what the report will look like until you do preview it: you may have grouped on one field, summed another, changed the font for a third, and so on. You have to go into the Properties dialog for each field to see how it’s formatted in the report. For example, in this report, you can’t immediately tell how each field appears in the report:

fields

One of the things we wanted to add is the ability to see the formatting for each field without having to go into the Properties dialog for each one. We decided to do that using balloon tips.

ctl32_BalloonTip is a class created by Carlos Alloatti that’s part of his ctl32 library. It provides the ability to display balloon tips in a VFP form. Balloon tips are similar to tool tips but are much more attractive, give you greater control over their appearance, and can display a lot more text. I discussed this class in detail in the July 2011 issue of FoxRockX. Here, you can see that the Freight field is summed at group breaks, displays the percentage of the total, and is formatted as a currency value. All you have to do is hover your mouse over the field in the list and the balloon tip tells you what you need to know.

balloon

Getting the balloon tip to display the settings for the field under the mouse pointer was a little tricky. The biggest issue is how to know what “line” the mouse is over in the list. There isn’t a property of the Listbox class that tells you that so you have to calculate it using the following factors:
  • The current mouse position. If you do this in the MouseMove event like I do, the X and Y coordinates are passed as parameters; it’s the Y value we need. However, the Y value is relative to the form, so we have to subtract the location of the top of the Listbox. We can’t use the Top property because the Listbox may be inside a container (in this case, it is), so we’ll use OBJTOCLIENT() to get the top of the Listbox relative to the form.
  • The height of a line. We can get that using FONTMETRIC(1) to measure the height using the Listbox’s FontName and FontSize properties. We’ll then divide the calculated mouse Y position by the height to get the line number.
  • Where the Listbox is scrolled to. If the user scrolls the list, the line number of the item under the mouse needs to be adjusted by how far down the user scrolled. Fortunately, the TopIndex property of Listbox tells us that, so we’ll add that to the value calculated above.
Here’s the code for the MouseMove method of the Listbox:

lparameters tnButton, ;
     tnShift, ;
     tnXCoord, ;
     tnYCoord
local lnHeight, ;
    lnLine, ;
    lcLine, ;
    lcField, ;
    loField
lnHeight = fontmetric(1, This.FontName, This.FontSize) + 2
lnLine   = int((tnYCoord - objtoclient(This, 1))/lnHeight) + ;
    This.TopIndex
lcLine   = transform(lnLine)
lcField  = This.List[lnLine, 2]
if This.Tag <> lcLine and not empty(lcField)
      loField = Thisform.oReport.oFieldsCollection.Item(lcField)
      if vartype(loField) = 'O'
          Thisform.HandleBalloonTip(loField)
      endif vartype(loField) = 'O'
      This.Tag = lcLine
endif This.Tag <> lcLine ...

A few things about this code:
  • There’s a little space between lines in the list, so we have to adjust the value returned by FONTMETRIC(1). I thought adding FONTMETRIC(4) (the leading) would be reasonable but that ended up being too high. I hate using a constant like “2” here but am not sure what the adjustment value can be derived from.

  • Not everyone knows this, but the List and ListItem members of Listbox can be 2-dimensional arrays. In this case, the first column of the current row contains the caption of the field displayed to the user and the second column contains the field name, which is used as an index into a collection of the fields in the report. To add a second column to List and ListItem, use code like:

    list.AddListItem(lcCaption)
    list.AddListItem(lcFieldName, list.NewItemID, 2)

  • MouseMove fires when the mouse moves even a pixel. We really only need to update the balloon tip when the user moves the mouse to a new line, so we put the line number into the Tag property (I could’ve added a specific property to a Listbox subclass but didn’t want to change the class used in the existing form) and only call the form’s HandleBalloonTip method when the line changes.

  • HandleBalloonTip does the actual work of displaying the balloon tip. I’m not going to show the code here because it’s fairly lengthy and specific to Stonefield Query. Basically, the code consists of building a string of the contents to display in the balloon tip and then displaying it using:

    This.oBalloonTip.ctlShow(6, lcText, toField.cCaption, 1)

    6 means display the balloon tip at the mouse location and 1 means use the information icon in the balloon tip.
That’s it. Not a lot of code, but it took a few minutes to work out the calculations to get the item under the mouse. Hopefully, this blog post inspires you to look at Carlo’s balloon tip control and saves you some time if you want to use it with listboxes.