Why not just use a unit? Units are perfectly well suited for encapsulating functionality. They have two sections, the interface is what is visible to the outside, and the implementation is only visible inside the unit.
....
Yes, thanks. I did use a unit, but in case I develop other class based GUI elements I wanted the list dialog variables to be self contained. I finished it this morning, here's a short video and the class declaration code:
https://youtu.be/MC-tlEiMX2Ytype
LGC_FileDialog = class
private
const
MaxItems = 300; // limit for file list - needs more error checking
Maxbuttons = 2;
max = 14;
ev_ok = 1000;
ev_cancel = 2000;
type
buttonType = record
event: integer;
Rect: Trect;
Txt: string;
end;
ItemType = record
Id: integer;
Info: string;
end;
ListType = record
List: array[1..maxitems] of itemtype;
Items: integer;
end;
ContentType = record
IdRef: integer; // reference to List item
Rect: Trect;
end;
var
bitmap: pointer;
sz: longint;
uprect, downrect, scrollrect, ScrollButton, outerRect,
DisplayRect: Trect;
ScrollButtonSize: integer;
Contents: array[1..Max] of ContentType;
ListContents: ListType;
EventCode: integer;
EndResult: boolean;
Buttons: array[1..2] of buttontype;
ScrollPercentage: double;
Rowlimit, ScrollDownLimit: integer;
changed: boolean;
mx, my, mb: longint;
key: char;
x, y, spot, xx, yy, w, d: integer;
currentrow: integer;
public
var
ErrorCode, Steelblue, Gray: integer;
constructor Create(xxx, yyy: integer; Fmask: string);
destructor Destroy; override;
procedure drawbutton(IB: integer; Up: boolean);
procedure SetButtons;
procedure UpDateScroll;
procedure highlight(fc, bc: integer; Yes: boolean);
procedure scrolldisplay(startRow, Endrow: integer);
function createList(filemask: string): boolean;
function run(var returnstring: string): boolean;
procedure paint;
procedure scrollbuttonactive(TheRect: Trect);
end;
And it gets called as (after graph mode initialized by PTCGraph):
filedialog := lgc_filedialog.create(400,200,'*.arr');
if filedialog.errorcode=0 then
begin
if filedialog.run(ts) then
begin
setcolor(white);
outtextxy(400,100,'Returned file name:'+ts);
end;
end
ELSE
BEGIN
SETCOLOR(15);
outtextxy(600,100,'ERROR!');
end;
filedialog.destroy;
In the video I'm showing the scroll action using the scroll button controls, but you can also click on
the list to select a item as well. I'm just going to group my variables by type in the code and it's done.)
I'm happy with how it came out, but now I want to be able to change directories within the dialog as well
to add full functionality. For my game asset tools though it's fine as I stay in one folder for each project usually.
I'll probably have to add a file attrib field to the "itemtype" record and then if it isn't "archive" then change directories and rebuild the list..... or something like that

I also modified it now to allow me to change all the colors used by the filedialog so I can change palettes from the default ptcgraph palette.