//--- OBJECT WRITE BEGIN --- new GuiControl(loadFileDialog) { profile = "GuiDefaultProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "0 0"; extent = "640 480"; minExtent = "8 8"; visible = "True"; setFirstResponder = "True"; modal = "True"; helpTag = "0"; new GuiWindowCtrl() { profile = "GuiWindowProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "205 148"; extent = "260 242"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; helpTag = "0"; text = "LOAD FILE"; resizeWidth = "True"; resizeHeight = "True"; canMove = "True"; canClose = "True"; canMinimize = "True"; canMaximize = "True"; minSize = "50 50"; closeCommand = "Canvas.popDialog(loadFileDialog);"; new GuiScrollCtrl() { profile = "GuiScrollCtrlProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "4 24"; extent = "181 212"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; helpTag = "0"; willFirstRespond = "True"; hScrollBar = "dynamic"; vScrollBar = "alwaysOn"; constantThumbHeight = "False"; new GuiScrollContentCtrl() { profile = "GuiScrollContentProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "1 1"; extent = "161 210"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; helpTag = "0"; new GuiTextListCtrl(loadFileList) { profile = "GuiTextArrayProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "0 0"; extent = "64 64"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; altCommand = "eval($loadFileCommand); Canvas.popDialog(loadFileDialog);"; helpTag = "0"; enumerate = "False"; resizeCell = "True"; columns = "0"; noDuplicates = "false"; }; }; }; new GuiButtonCtrl() { profile = "GuiButtonProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "191 181"; extent = "60 20"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; command = "eval($loadFileCommand); Canvas.popDialog(loadFileDialog);"; helpTag = "0"; text = "LOAD"; }; new GuiButtonCtrl() { profile = "GuiButtonProfile"; horizSizing = "right"; vertSizing = "bottom"; position = "191 205"; extent = "60 20"; minExtent = "8 8"; visible = "True"; setFirstResponder = "False"; modal = "True"; command = "Canvas.popDialog(loadFileDialog);"; helpTag = "0"; text = "CANCEL"; }; }; }; //--- OBJECT WRITE END --- function fillFileList(%filespec, %ctrl) { %ctrl.clear(); %i = 0; for(%file = findFirstFile(%filespec); %file !$= ""; %file = findNextFile(%filespec)) %ctrl.addRow(%i++, fileBase(%file) @ fileExt(%file)); } //------------------------------------------------------------------------------ // ex: getLoadFilename("stuff\*.*", loadStuff); // -- calls 'loadStuff(%filename)' on dblclick or ok //------------------------------------------------------------------------------ function getLoadFilename(%filespec, %callback) { $loadFileCommand = "if(loadFileList.getSelectedId() >= 0)" @ %callback @ "(loadFileList.getValue());"; Canvas.pushDialog(loadFileDialog, 99); fillFileList(%filespec, loadFileList); }