Binomial Calculator

Discussion in 'Share Your Creations' started by dlfallen, Apr 30, 2007.

  1. dlfallen

    dlfallen Active Member Licensed User

    Original post . . .

    I plan to port several of my VB statistics programs over to the PPC using Basic4ppc. Attached is the first on the list, a binomial calculator.

    The program is a good example (IMHO) of controlling the appearance of the Table control. When adding rows and columns, the table control will generate scroll bars when the row width exceeds the table width, or the sum of the row heights exceeds the table height. I dislike the appearance of the Table control when the rows and columns do not fill the table dimensions, and the generation of scroll bars messes up the appearance of the whole table.

    My solution is to resize the Table control when rows are added. Columns are static, so no redimensioning was necessary in that direction except when the vertical scroll bar is automatically introduced. So for 2 to 9 data rows, the dimensions of the Table increase to just fit the rows so the Table has a nice, clean appearance. When the 10th data row is added, then I stop adding to the height of the control, but I do increase the width by an amount necessary to accommodate the automatically generated vertical scroll bar. Otherwise, a horizontal scroll bar would have been automatically generated and that mucks up the display.

    In general, the header row has a different height than the data rows, so you need to know the header row height, the data row heights, the column widths, and the width of the vertical scroll bar if you are to use this method. You can see the values I used in the source code. The PC and the PPC have different values for the header row height, the data row heights, and the vertical scroll bar width. These differences are handled with the cPPC constant so the same source code generates a nice display on both devices.

    The values I used work well on my Ipaq 1940. I'd appreciate hearing if it works well on other devices.


    Attached Files: