RAV_ListFormat - template for saving and customizing list format

A standalone module and template for Clarion 10 (ABC) that allows your app’s users to customize any list (LIST/BROWSE)—saving settings separately for each user and each list—and adds a ready-made set of tools to the developer without writing a single line of hand-coded code.

With great thanks to Igor Stolyarov—this module and template were created based on his code and ideas.
Edited and designed by: A. Rybnikov

What it can do

For the app user

  • Drag and drop columns with the mouse to change the order, the cursor displays the wrap mode
  • Right-click on the column header - context menu: hide/show (including “show all hidden”), move left/right, adjust width to fit text or all visible columns, snap text/header left or right, lock column to the left edge, set the display format (numbers/dates/money) with a live example, zoom in/out/reset zoom
  • Full-featured editor window (“Table Settings”) - one screen:
    list of all columns with on/off checkboxes, status icons, precise width input (double-click on a cell)
  • search for a column using the * and ? masks
  • “All / Active / Hidden / Reduced / Increased” filters
  • Visual highlighting of modified columns — directly in the editor list and in the custom list itself, simultaneously
  • Combine adjacent columns into a group with a custom name (“Payment” above “Due” + “Paid”), rename a group, or ungroup a group
  • Column borders, header color and design
  • “Appearance” tab: row height, font size and family (5 options), grid color, row highlight color, mouse wheel sensitivity
  • “Description” and “Keys” tabs — built-in help for the end user
  • Window resizes with the mouse, “Reset to default settings” button (F5)
  • Single-move list zoom — Ctrl+ / Ctrl- (both NumPad and the main row of the keyboard), window buttons, or header menu items: the font, row height, and width of all columns are changed simultaneously. The zoom level is stored separately from user column settings—resetting always returns the exact original view, without damaging anything.
  • Two independent layout modes—compact (maximum rows on the screen) and horizontal (larger, for viewing a large number of fields), with their own sets of settings, can be switched with a single button.

For the developer

  • A completely standalone module—no ABC BrowseClass, no application dictionary, only native TopSpeed ??and ASCII. Attaches to an existing list without rewriting the procedure
  • Ready-made Clarion Template – drag and drop onto the procedure, specify the list object and unique settings ID, enable the desired functions (header menu, drag-and-drop, zoom, layout modes) – all code is generated automatically with clear Start/End markers
  • Two Control template buttons – “Open Settings Editor” and “Zoom Buttons (+/-/Reset)” – are dragged onto the window next to the list, automatically find the desired list, and bind to it
  • Works with multiple DLLs – the module is compiled once into a data DLL with Export List; in other DLLs/EXEs, only INCLUDE prototypes
  • On-the-fly settings migration – if users already have an old settings file in a different format, the module automatically migrates the data on first launch, without losing anything
  • Stable settings file structure – a reserve is provided for future expansion without recreating user files
  • Smart format merging - (currently only horizontal) when the list structure changes (adding or deleting a column by the developer, etc.)
  • Language changes (English, Russian)

Requirements Clarion 10, ABC
No third-party libraries - only standard RTL

Installation
Standard Clarion10\accessory\ structure (libsrc\win, template\win, images, doc) - unzip over the Clarion installation. Detailed instructions and an example of connecting to a standard or multi-DLL project are in the README.txt inside the archive.

Standalone, no dependencies on dictionary or ABC

Feedback and improvements to the template are welcome.

This template is provided “as is,” without any warranties. Use it at your own risk.

Rav_ListFormatEn.zip (61,8 КБ)
SCHOOL.ZIP (203,1 КБ)


Can you add some screenshots for viewing, please?

I have added some screenshots for your reference.

Cheers, thank you!!!

This zip only has the School.APP modified for RAV List.

Attached is the original Clarion 10 School Example with DCT and TPS files. It has the School.APP so you’ll need to replace that with the modified APP. I would delete the .CwProj and .SLN.

School_v10_Example.zip (721.5 KB)

Usage Instructions for a plain ?List (?MyList)

  1. If you don’t install the global template, you need to do the following manually:
  2. Files in the project: RAV_ListFormat.inc + RAV_ListFormat.clw — either via Redirection (then they just sit in libsrc\win\ and the IDE finds them automatically), or add them explicitly to Project → Source.
  3. Icons (bwf_*.ico, 14 files, see README section 6) — also add to the Project (even in manual mode: the “List Settings”/‘EDIT’ dialog is an INTERNAL window of RAV_ListFormat.clw, and it uses these icons on its buttons — they’re needed regardless of whether you use the .tpl template or not).
  4. INCLUDE(‘RAV_ListFormat.INC’),ONCE — Global Properties → Embeds → “After Global INCLUDEs”. This is a standard IDE embed point, no template involved — just type it in by hand.
  5. Libraries ClaTPS.lib / ClaASC.lib (Project → Libraries) — needed for storing settings (TopSpeed) and F12 export (ASCII).

Declare in (DATA)

Code: Select all

l_userID     LONG                    ! User ID (or use your own global variable)

‘UniqueID’ below is just a string literal, unique for this particular list (e.g. procedure name + a number) — no variable needed.

  1. Load the format when the window opens (LOAD)
    Where: right after OPEN(window) (in hand-written code) — or in the Init method, AFTER SELF.Open()/OPEN(window), if the window is on an ABC WindowManager.
?MyList{PROP:Alrt,255} = MouseRight     ! enable right-click on the list (column menu)

?MyList{PROP:Alrt,252} = CtrlPlus ! Ctrl + gray plus - zoom in

?MyList{PROP:Alrt,251} = CtrlMinus ! Ctrl + gray minus - zoom out

?MyList{PROP:Alrt,250} = 02BBh ! Ctrl + = (regular key) - zoom in

?MyList{PROP:Alrt,249} = 02BDh ! Ctrl + - (regular key) - zoom out

?window{PROP:Alrt,254} = MouseLeft ! ALRT on the WINDOW (not the list!) - start of column drag

?window{PROP:Alrt,253} = MouseLeftUp ! ALRT on the WINDOW - end of column drag

bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'LOAD', l_userID, 0) ! load the saved list format

  1. Save the format when the window closes (SAVE)
    Where: right BEFORE CLOSE(window) (in hand-written code) — or in the Kill method, BEFORE SELF.Kill()/CLOSE(window), if the window is ABC-based.
bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'SAVE', l_userID, 0)  ! save the current list format
  1. Mouse handling on the list itself (right-click menu + Ctrl+/Ctrl- zoom)
    Where: in the window’s event loop — CASE EVENT() (hand-written ACCEPT loop) or the TakeEvent/TakeFieldEvent method (ABC), checking EVENT:AlertKey specifically on the ?MyList field.
CASE EVENT()

OF EVENT:AlertKey

IF FIELD() = ?MyList ! specifically our list

IF bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'MOUSE', l_userID, 0, 7) THEN CYCLE END ! 7=menu+drag+zoom

END

END

  1. Column drag handling (the ALRT is set on the window, not on the list)
    Where: same place, in CASE EVENT(), TWO separate branches — EVENT:PreAlertKey and EVENT:AlertKey AT THE WINDOW LEVEL (not tied to FIELD(), fires regardless of which field is active).
CASE EVENT()

OF EVENT:PreAlertKey

IF bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'MOUSE', l_userID, 0, 7) THEN CYCLE END ! start of dragging

OF EVENT:AlertKey

IF bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'MOUSE', l_userID, 0, 7) THEN CYCLE END ! end of dragging

END

(If you already have an OF EVENT:AlertKey branch from step 3 — don’t duplicate the CASE, just add this line into that same branch, before or after the FIELD() = ?MyList check.)

  1. Button/hotkey for “List Settings” (format editor dialog)
    Where: your button’s handler (OF ?btn_Settings) or a hotkey.
OF ?btn_Settings

bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'EDIT', l_userID, 0) ! open the format settings dialog

A lot of this could be in your Inc/Clw so the Template can generate less and using in a Hand Coded List is easier. As things change in your code (different keys or icons) you can edit your code and it works for dev with no changes.

Setup a Procedure with all the Alert code and other init. Note the Prop:Alrt can all be { ,255} and the RTL finds a spot.

bwfRAV_Brw_InitList(window MyWnd, LONG MyListFeq)
  Code
  MyListFeq{PROP:Alrt,255} = MouseRight     ! enable right-click on the list (column menu)
  MyListFeq{PROP:Alrt,255} = CtrlPlus ! Ctrl + gray plus - zoom in
   ...etc
  MyWnd{PROP:Alrt,255} = MouseLeft      ! ALRT on the WINDOW (not the list!) - start of column drag`
  MyWnd{PROP:Alrt,255} = MouseLeftUp    ! ALRT on the WINDOW - end of column drag

These could all be specified in your Inc or Clw as Pragma’s

  PRAGMA('link(CheckOn.ico)')  !same as PRAGMA('project(#pragma link(CheckOn.ico))') 
  PRAGMA('link(CheckOff.ico)') !same as PRAGMA('project(#pragma link(CheckOff.ico))')

For drivers also put Pragma’s in your INC so just works:

  PRAGMA('link(ClaASC.lib)')            !#PROJECT('C%V%ASC%X%%L%.LIB') 
  PRAGMA('link(ClaTPS.lib)')            !#PROJECT('C%V%TPS%X%%L%.LIB')

You’ll see this in CwUtil.clw that adds the DOS using the old syntax that works in C6.

  OMIT ('=== DO LINK', lib_mode)
    PRAGMA('link(C%V%DOS%X%%L%.LIB)')
! === DO LINK

CarlBarnes, you’re right - and I’ll be honest, I just plain missed that solution myself. Went and checked the receipts anyway just to be sure, and yeah, it holds up: the stock ABC libs (abprpdf.clw, abprtext.clw, abprxml.clw) PRAGMA-link their own icons exactly the way you described, and cbrowse.clw sets two different ALRT keys with the same {,255} index on one control - so the RTL really does hunt down a free slot instead of clobbering the previous one.

Folded both into the module:

  • All 21 icons plus ClaTPS.lib/ClaASC.lib now link themselves straight out of RAV_ListFormat.clw. Project source list just got noticeably shorter.
  • Added bwfRAV_Brw_InitList() - one call, sets up every ALRT and does the initial load. What used to be a page of boilerplate for anyone bolting this onto a plain ?List is now a single line.

Compiled, ran it, works. Thanks for pointing out something I should’ve caught on my own.

Usage Instructions for a plain ?List (updated, v2.3)

As of v2.3, icons and libraries (ClaTPS.lib/ClaASC.lib) are linked automatically via PRAGMA(‘link(…)’) right inside RAV_ListFormat.clw — no need to add them to Project by hand anymore. Setup is down to three steps:

Files in the project: RAV_ListFormat.inc + RAV_ListFormat.clw (and bwf_*.ico, 21 files) — either via Redirection, or add the .clw/.inc explicitly to Project → Source (the icons/libraries link themselves).
INCLUDE(‘RAV_ListFormat.INC’),ONCE — Global Properties → Embeds → “After Global INCLUDEs”.
That’s it — Project → Libraries is only needed if the linker unexpectedly reports Unresolved External TOPSPEED/ASCII.

Declare in DATA

l_userID     LONG                    ! user ID (or use your own global variable)

‘UniqueID’ below is just a string literal, unique for this particular list.

  1. Setup on window open — one call instead of eight lines
    Where: right after OPEN(window).
bwfRAV_Brw_InitList(window, ?MyList, 'UniqueID', l_userID)  ! sets up ALRT (menu/zoom/drag) + loads the saved format
  1. Save the format when the window closes
    Where: right before CLOSE(window).
bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'SAVE', l_userID, 1)  ! save the current list format
  1. Mouse handling (right-click menu + zoom + drag) — one call covers both events
    Where: in the window’s event loop.
CASE EVENT()
OF EVENT:AlertKey OROF EVENT:PreAlertKey
    IF bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'MOUSE', l_userID, 1, 7) THEN CYCLE END  ! 7=menu+drag+zoom
END
  1. “List Settings” button/hotkey
    Bottom line: steps 1-2 are always required, step 3 - only if you want mouse-driven menu/drag/zoom, step 4 - for a manual settings button. All of this works on any ?List - no ABC BrowseBox required (unlike the .tpl template itself).
OF ?btn_Settings
    bwfRAV_Brw_ColumnEdit(window, ?MyList, 'UniqueID', 'EDIT', l_userID, 1)  ! open the format settings dialog

Rav_ListFormat.zip (64,4 КБ)