Extension of the VOEditors / Designer / WindowCloneSelectDlg
Opened this issue · 8 comments
Hello,
we are in the final stages of converting our programming from VO to X#. During the tests of the daily work steps by my colleagues, a very important point was noticed when creating new VO windows.
Our application contains hundreds of VO window classes, when creating a new one, an existing window is usually used as the basis. Unfortunately, the function "Clone from other Window" only lists the *.xsfrm files of the own Visual Studio project and the projects referenced in the project. By splitting the original project into small DLL projects in X#, "Clone from other Window" should deliver all *.xsfrm files of the solution, or by browsing and selecting a directory which the user chooses.
Currently in the designer project the listed files are from file:Project:GetFilesOfType(XFileType.VOForm, TRUE).
You could also select a folder and list all "*.xsfrm" files from it, if you do not select a folder everything remains as it is.
Example of CLASS WindowCloneSelectDlg :
CONSTRUCTOR(File AS XFile, cFileName AS STRING)
SUPER()
SELF:InitializeForm()
VAR fileNames := File:Project:GetFilesOfType(XFileType.VOForm, TRUE)
// the extention
begin using var fbd := new FolderBrowserDialog()
local result as DialogResult
result := fbd.ShowDialog{}
if result == DialogResult.OK .AND. !String.IsNullOrWhiteSpace(fbd.SelectedPath)
//replace or add the files....
fileNames = Directory.GetFiles(fbd.SelectedPath, "*.xsfrm")
endif
end using
FOREACH VAR FileName IN fileNames
// Suppress the frm that we are adding !
IF !String.Equals(FileName, cFileName,StringComparison.OrdinalIgnoreCase)
SELF:oFilesList:Items:Add(FileName)
ENDIF
NEXT
RETURN
It has also been noticed that the list of *.xsfrm files to be selected in "Clone from other Window" can be very long, some kind of search or filtering in it would be very helpful. The used control System.Windows.Forms.ListBox knows a method FindString Listbox FindString
Christian,
Please feel free to write this code and send us a pull request. We are an open source project and contributions like these are more than welcome!
Guys, I have moved the window clone select dialog to a separate file in a new Dialogs folder, so you can edit it visually. Christian, please pull those changes and make your adjustments based on the new code. I think you'll need to temporarily revert your previous changes, but of course you can reapply them afterwards. I hope I have added everything correctly...
Chris, you have published your changes in XSharp.VoEditors in the branch feature/Runtime, unfortunately I can't pick any changes from it. My fork is based on the main branch.
Argh, apparently I still can't get to grips with git... And with 40C all day I have no brain power remaining to look into it now, so for now I'm just attaching below the current VisualStudio\XSharpVoEditors folder. Christian, please make your changes on it and send me back the modified files and I'll upload them back.
Hi Chris, return the customized project in the ZIP file. At the same time I have also send a PULL request via GIT.
Christian thanks, looks good! Only very minor problem is that when you click the Search button, it also adds the "current" window we are editing.
I will let Robert handle the pull request when he returns from vacation.
Hello Chris,
I have now added the filter for the currently edited file and the start directory for the FolderBrowser dialog.
Excellent! Another thing I am thinking that might help with quickly finding the intended item, is to change the LsitBox into a ListView in details mode, with a column for the name and another for the directory of the file, with capability to sort by one or another or both. But of course since you are actively using it, it's up to you to make it most suited to your needs (and for other developers of course).