Enhanced Window Preview with “Fit Data” and LIST's that always work

On my GitHub I posted a new class (cbVlbPreview) to enhance Window Preview. I created it to fix problems with LIST controls by using a VLB, then added more.

The Designer Previewer generates a CLW and builds a running EXE. This will be 100% accurate of what you will see at runtime versus the Designer has .Net controls. A LIST can have many modifiers (colors, styles, tree, icons, tips) that the IDE generator does not always handle well or are broken.

Those ugly distracting colors are used for a Column with Colors … who chose black on black? The Style columns show a mix of colors and fonts. The window produced by my preview is below. For Colored columns my preview simply uses Maroon for all rows, Styles use Green or Teal. (See the next post for how to remove these)

The SV Previewer tries to supply “Sample Data”. Many times numbers show ###.## as seen in the first screen capture. I provide what I call “Fit Data” with numbers showing the exact maximum digits 123,456.12 that fit. I handle @P###P and @K###K formats which the SV previewer does not.

For strings I simply supply “Abcdefghijk…” which I find a bit ugly, but it does give an idea of what will fit. See below for how to edit the column data.

The “Fit Data” is also applied to ENTRY, SPIN, COMBO and STRING @N @P @K picture controls. If the picture allows a sign then a negative shows. The 12,345.12 makes it easy to tell if my picture allows the digits I need. The sample number shows the maximum commas possible, the RTL will use those commas spots for digits.

If you want to see the original Clarion Preview window hold down the SHIFT key when you click the preview button, and conttinue to hold it until the preview appears.

To have this enhanced preview download the 7 LibSrc files from this Repo and place them in your Accessory\LibSrc\Win folder. Only the CbVlbPreview.Inc and .Clw files produce this new preview. The CbWndPreview class provides a secret button at the top of the window with many many features.

When the preview window is displayed you can right-click on a LIST control for a POPUP menu that offers options to alter the list data. E.g. if you find the color or icons distracting you can remove them.

If you select “Edit the Column Data”, or double-click on a cell, the below Edit window opens to let you change the sample data to anything you like to help you test if the column fits your desired data.

The Data… button pops up some sample data. I chose reasonably long strings to check fit like the first name Bartholomew. The last name Rostenkowsky is long so better fit, hyphenated last names could be twice as long.

The About window is mainly there to remind you that the regular IDE Preview will appear if you HOLD DOWN the SHIFT key until the preview window appears.

What makes this all work is the Preview Generator inserts INCLUDE('WindowPreview.INC','section') in the preview code. My INC file includes my VLB Class that finds all the LIST controls on the Window and changes the FROM(Queue) to a VLB (Virtual List Box) that my code in the CbVlbClass provides the data. The class will also scan for numeric @N ENTRY controls and change the IDE sample data to my Fit Data. It also changes @P and @K to correct sample data.


  !Put variable and equate declarations here
  INCLUDE('CbVlbPreview.INC'),ONCE  !Class for LIST Sample data and @n @p @k

WndPrvCls   CBWndPreviewClass
ListPreview CbVlbAllPreviewClass !FYI: If Shift is Down the Init does not happen
FixListPrv  BYTE                 !Must wait until InAccept. There is no SECTION for BeforeAccept or AfterData

  !Put code that needs to be executed after the window is opened, but before entering the ACCEPT loop

  WndPrvCls.Init(2)   !2=Secret Button Across Top; 1=Upper Left Corner 8x8 (default)
  0{PROP:System} = 1  !SYSTEM Menu to close window because below set: windowPreviewerCanExit__=False

  !Let ESC close window and use Mouse if Window ALRTs. ALRTs do NOT work in a Preview.  
  LOOP K#=255 TO 1 BY -1 ; 0{PROP:Alrt,K#}=0 ; END  

  IF ~FixListPrv THEN           !04/04/2021 Setup VLB to supply Preview Data
      ListPreview.Init()        !Do after Generated preview sets up LIST.
      ListPreview.EntryInit()   !Setup ENTRY with 1,234.12.

  windowPreviewerCanExit__ = FALSE  !Carl likes button clicks NOT closing window to test Alt+Keys. Can close with SYSTEM Red X (turned on above) or Escape (if not alrt). 

  windowPreviewerCanExit__ = FALSE  !Carl likes button clicks NOT closing window to test Alt+Keys. Can close with SYSTEM Red X (turned on above) or Escape (if not alrt). 

If you want to not use my preview simple rename the WindowPreviewer.INC file in LibSrc,

See also my post on The Window Previewer could not display the window

Carl its fabulous no doubt.

The preview class we will use with a notice with your permission.

The addition we are working on is using an expression engine first written in turbo C to runtime the colors and styles in the virtual list box code…

i will delete this post later.

I’m trying to imagine what Clarion can’t do with colors & styles that would cause you to turn to an external C compiler.

Its an expression engine and also under testing a complete replacement scripting engine…not some bit of C code. Note: im not the author just an accounting person.

the case is where a runtime queue is present with no columns present to support colors…

we use a lot of runtime stuff where data is stored in XML from runtime data structures…

clarion supports runtime queues, files and data as a structure of 4 longs…

we dont use structured data from the DCT…

therefore color and styles are not defined…

In fact sub business classes dont come coupled with the GUI…

we dropped the normal clarion program structure 20 year ago when classes first appear…

the first runtime stuff we did was xlib from alexi… we never looked back and eventually got the russian code which we are re working…

the code posted by carl is wonderful but not something we can plug in…

now you might say how do we use the browse class… simple it get called at runtime as a proxy object.

OK, but since you’re already doing the VLB, you don’t need no stinkin’ LONGs in your QUEUE to represent the colors and styles. :slight_smile:

All you really need in the VLBProc, is a way to track which columns support colors and/or styles. Then you do the math to decide which entity the passed column# to the VLBProc is supposed to represent, then return that thing (color, style, data, etc).
The left-hand listbox of my color explorer is a Clarion LIST control with colors, but there’s no queue representing the data at all. https://www.screencast.com/t/rjNx9lrn.

Very Slick.

we expect to run expressions and scripts to handle lots of things not just colors.

And yes a calculation can i think determine the virtual column number…

fabulous example.

Ok we have decided to try a VERY simple minded approach to numbering the virtual fields that doesnt use the complex class code above.

KISS approach. Kept it simple stupid.

  1. Create a queue of Column there ordinal positions?

  2. Sets if the Column is to have a Color set of field to True, Style to True, Icon and Tree.

  3. Generate a List of column numbers for the virtual list to look up with all actual and virtual fields numbered from the first list.

  4. Assign a field in this list to hold the script address handle to run when the virtual list processed the Columns in the Virtual Queue.