Add new form to Template Library (Object repository) Delphi Xe2 - delphi

Delphi Xe2 Update 4 Hf 1
I create the new form
I modify and save
On the form I click the right button of the mouse and I choose "Add to Repository", where: "Delphi Files"
I close all
File, New, Vcl form application - Delphi
File, New, Other, Delphi Files: here I do not see added before the form :(
File, New, Customise, Delphi Files - here I see
Tools, Template Libraries, Default (RAD), Properties, Delphi Files - and here I see
I tried to make changes to file C:\Users\ [mylogin]\Application Data\Embarcadero\BDS\9.0\RADStudioRepository.xml (and C:\Program Files (x86) \Embarcadero\RAD Studio\9.0\ObjRepos\en ) but results are not present.
In "manual" at me it has turned out to add the project as it is described here: http://docwiki.embarcadero.com/RADStudio/en/Creating_Template_Libraries (or this: http://blogs.embarcadero.com/pawelglowacki/2011/11/28/39454)
<TemplateLibrary Version="0.1" id="GuTemplateId">
<Name>Gu Template Library</Name>
<Description>Gu</Description>
<Items>
<Item id="GuProject1" Creator="DelphiProjectRepositoryCreator">
<Name>GuProject</Name>
<Description>Standart Gu project</Description>
<Author>Gu</Author>
<Icon>Project\GuProject1_Icon.ico</Icon>
<Projectfile>GuProject1.dproj</Projectfile>
<DefaultProjectName>GuProject1</DefaultProjectName>
<FilePath>Project</FilePath>
</Item>
</Items>
</TemplateLibrary>
The note: it was long taken with keys < / > and a file .bdsproj which is not created but it is required, both problems has solved
And how to insert _ only _ the form and it is desirable in the folder "My" (or at least in Delpfi Files or Other Files)
++
Still: some external components are established: TMS, LMD, DEVExp, Jedy. On a photo it is visible, that some of them have folders or for example in Delphi Files - JCL Exception Dialog. But in xml-files (above) I can not find on their the reference. How it is made?

IMHO, this looks like a bug. Here's a workaround:
After adding the form to the repository, do the following:
File\New\Customize... find your item, drag and drop it into Menu Items, click OK. This will make the item visible in the "New Items" (File\New\Other...) dialog.
However, it will also add the new item to the top-level menu File\New which may not be what you want. You can go to File\New\Customize... again and drag it out of Menu Items, click OK. The new item will disappear from the top-level menu but it will stay visible in the "New Items" dialog.
I've tried this with Delphi XE2.
Edit: To answer your question, "How it is made?" (without using the repository), probably with OpenTools API. Here's a very old article which shows how to create and register your IOTAModuleCreator implementation in a design package.

Related

Adding new "tab" to a bug work item in TFS 2017

I am trying to add a new "tab" to bug item in TFS 2017. Looking at the "tabs" you see things like "Steps to Reproduce", System, etc.
I have found information on changing work item types but nothing about adding a new "tab" across the top where you see Steps to Repro, System, Test Cases, Tasks. The change I want to make may not be possible? Or it is possible I don't know the correct verbiage to use when asking google. The think I want to change may not be a tab control at all it maybe something else different.
Thanks
***************** Updated questions after posting *****************************
After playing around with Process Editor -> WIT -> Open WIT from server -> Bug
as suggested by Andy Li-MSFT I don't see a lot of control on the formatting on the tab. I was planning to add fields in a grid like pattern like a table as shown below. I am able to get the values in the drop down list for field1 and add the fields. However I have a couple follow up questions if you have time.
Setting either the control or column for the control to read-only the column will not render when adding a new bug. I have a little more control if I set AllowedValues and Frozen for the column however the value can still be changed. Is there a better way to set read-only?
There is not much control on the layout. I am OK adding a lot of fields but would like them to be displayed in a table like structure. Is there a way to control the look of the fields on the form?
Is there a way to add the fields in a grid? This would be ideal so I only have one header for each column.
The last-updated-by and last-updated-date. Is it possible to track on a row level who made a change? If not I would be OK just adding a last updated by and last updated date to the new tab. Row level updates would be nice.
<pre>
Field 1 Field 2 (Read-only) Field 3 Last Updated By Last updated Date
Status (completed, empty, N/A) "Some text here which describes something to do" "Optional comments" tfs user name date/time
Status (completed, empty, N/A) "Some text here which describes something to do" "Optional comments" tfs user name date/time
</pre>
You need to modify the WIT definition file (Bug work item type in your scenario).
You can try below ways to do that:
Export the WIT definition file with witadmin commands, add a new tab under <TabGroup> and add a new control for it, then save and import the file. See Import, export, and manage work item types for details.
e.g:
<Tab Label="Tab0501">
<Control FieldName="System.ChangedDate" Type="DateTimeControl" Label="Test0501:" LabelPosition="Left" />
</Tab>
You can also use the TFS Power Tools to export/import WIT definition files or directly modify the files from server:
Visual Studio 2015 : Microsoft Visual Studio Team Foundation Server
2015 Power Tools
Visual Studio 2017 : TFS Process Template Editor
Reference below screenshot to do that.
Another way is writing an extension to Extend the work item form, you can reference my answer in another thread to do that.

VFP font size in command window

In the VFP development environment both the command window and any code windows which are open display characters in Courier font, possible 10 pt. I would like to reduce the size of these characters, to see more lines on the screen.
Have tried going into Tools | Options | IDE and have changed several font specifications (for Desktop, Program files, Code Windows, Procedures), clicked on 'Apply' in an attempt to reduce the size of these character on the screen. This has not been successful.
How can I reduce the font size used for code when I am editing it, please?
Check the Override individual settings checkbox on the Options | IDE tab. Otherwise, if you've previously edited a particular PRG, you'll see the font you used then.
For the Command Window, right-click, Properties to set the font.
Most of the time, I use the default, but occasionally I change it by right-clicking within the MODIFY COMMAND window I'm working in, going into "Properties...", and changing the font size. It only applies when editing that filename, though. Many years ago I think I tried changing it globally, as you seem to have, and remember it not 'sticking', so henceforth I always changed it on a file-by-file basis when I needed to.
I think what you are looking for is under Tools / Options / EDITOR tab, and save whatever defaults you want and set as Default.
Additionally, another thing I have done this in the past and created my own master settings resource file. By default when you start VFP, a "resource" file is set to ex: C:\Program Files\VFP\blah\FoxUser.dbf (and the corresponding .fpt file)
What I would do is this. Use the resource file and make an EMPTY copy of it to a new location, such as the working folder of your project.
use ( sys(2005)) again alias tmpResource
copy structure to MyVFPResource
set resource to MyVFPResource
close tables all
The resource file keeps track of almost every thing you open / work with and retains settings such as window area, position, etc. Some things I like to have as a "default", such as when editing snippet methods in screen or class designer. Such as to always have the row/column of a file displayed, have other settings.
An example of common .prg files. Do a simple MODI COMM MyTest.prg. Then once a simple .prg file is open, go to Edit, then Properties. Click on all the settings you want (including font size, line/column, syntax coloring, tabs vs space preferences, etc. Click the checkbox for "Apply to .PRG files". and click ok.
Now, open your resource file AGAIN so you can see what is stored.
use ( sys(2005)) again alias tmpResource
BROWSE
You will see many rows, but at the bottom will be the most recent entries. You should see 3 records listed as "WINDMODIFY" which represents the "MODIFY COMMAND" of whatever prg file. Now, open the "Name" memo field. One will be listed as .prg, another will be "DEFAULT", and the last will be the actual "mytest.prg" you started with. Get on the "DEFAULT" version record. Now you can change the "READONLY" column from FALSE to TRUE (F/T) and it will lock these settings for ALL .prg files. You can then delete the other rows.
You can apply these same principles to modifying form code snippets. Open a form, double-click on any method, then EDIT / Properties, do the same, but checkbox for "Apply to method code".
Browse the resource file and look at the "WINDSNIP" rows. Again, look for "DEFAULT" and mark that readonly as .T. and you can delete the other. The resource file will literally save every snippet window specific to the form, object, method, etc.
Do the same for visual class file editing too.
Similarly can be done for toolbars and more as you browse and see. When you are done making all the changes you want, purge out all the other fluff, close the resource file and set it to read-only so no additional garbage gets pulled into it.
If you need to change in the future, make the table editable again, make changes, then readonly the table again.
Then, all you have to do is at VFP start, do
set resource to MyVFPResource

How to use templates defined in other package without adding source file to the project?

I've created a package which contains several templates (TFrame descendants).
These templates has been added to the palette.
In other packages, I'm trying to use these templates but each time I add one of them, a message appear:
The following unit: %s, is needed in your project to create the
template. Do you wish to add it?
mrYes:
Source file is added to the project.
Furthermore, it causes the following error on compiling:
E2200 Package '%s' already contains unit '%s'
mrNo:
It's ok, but the question is asked each time I place one of my
templates. Me and my collegues will use these templates alot of times and I really would like to avoid that message.
Update 1:
Here are steps to observe the described behavior:
Create a package project named Package1.
Add a TFrame descendant named MyTest.
Add TMyTest to palette (Structure window, right click, add to
palette).
Set project output directories to .\out
Build the project.
Add \out to library path.
In the same projectgroup, create a package project named Package2.
Add Package1, to "requires" (in Package2.dpk).
Add a form.
Add a TMyTestTemplate to the form.
Update 2:
I'm looking for a solution which works with Delphi 2007 and Delphi XE7.
A bit more work but one that should fit your needs:
Create Package FooRuntime(Mark RuntimeOnly), add your TMyFrame
Create Package FooDesignTime(Mark DesigntimeOnly), requires FooRuntime, Registers your frame
Install FooDesignTime
Link your other project to FooRuntime
Without the packages the IDE seems to fail to recognize the units.

How to keep editor alive in Virtualtreeview?

I'm trying to build a simple 2 columns grid "property editor" based on VirtualTreeView.
(I want to mimic look and user experience seen on Delphi's IDE object inspector)
The component is working almost and can handle multiple editors,
but I'm facing an annoying bug :
When I click on a new node (a new row), the node is selected and the editor appears, regardless of the column I've clicked on. It's expected and OK.
Then, when I click on the first column of the same row, I expect to see my editor content validated and the editor keeping focus (like in delphi's object inspector).
But the editor content is validated then it disappear and the entire node (row) is selected. The editor won't get back (even if I click on second column), until I select another node and click back on the previously selected node.
EDIT : added illustration and precision about my code.
about the code :
I do not have inserted code here because I used (as a starting point) the exact same code as the one found on Advanced Demo (properties page)
What I tried and found out :
the 2003's compiled Advanced demo (properties tree page) found here seems to works like what I expect from my component (and from virtual treeview).
But when I compile this same demo (I tried with versions 4.5.2, 4.8.7 and even 5.0.0 from current trunk on google code, on both delphi 2007 and 2009) the bug reappears !
I first think there was a documented breaking change between 2003 and more recent versions,
but I can't find anything.
I've also played with all available options trying to solve this, but without success.
I still don't know if this problem comes from new delphi RTL or a breaking change (bug?) in virtualtreeview.
so my questions :
do you have the same problem when compiling Advanced demo ?
any tip or workaround in code to solve my problem ?
As a side note, I nearly give up with virtualtreeview this afternoon and I wanted to try a solution with another component... I found this interesting question and decided to try berg's component, but was stopped in the buying process when reading an advice on their homepage (see my comment on the related question)
The VSTs onChange just gets called by changing the selection of nodes. The state will not change anymore, if the node is already selected. So, you have to implement a behaviour similar to Object Inspector on your own, e.g. by calling VSTs EditNode()-Method in the OnClick-Callback:
procedure TMainForm.VSTClick(Sender: TObject);
var node: PVirtualNode;
begin
node:= VST.GetFirstSelected();
if(node <> nil) then
VST.EditNode(node, EDITABLE_COLUMN_INDEX);
end;

Delphi "EClassNotFound" errors, and corrupted DFM possibility

I am getting a cascading set of "EClassNotFound" errors in in my Delphi 2007 project. Doesn't seem to be caused by the missing Name property value as often is the case, and though adding RegisterClass(XXX) in the initialization section(s) fixes the EClassNotFound error at hand, another one follows it seemingly indefinitely.
I finally cracked open the DFM file in text editor, and it looks likely corrupted to me (lots of non-ASCII characters amidst form element names, and very "unstructured" looking when compared to what I'm used to seeing in a DFM file). (I'd post a same here but not sure that's OK, w/the non-aSCII, so will hold off).
The form loads fine, and seems to compile / syntax check OK too, but once I run it, trouble.
Going back to early versions of it in SVN, it looks like it's been in this state for some time, which makes me think that either A) the DFM file isn't my problem, or B) the Delphi form-streaming is quite fault-tolerant/robust (Bonus Question: Which is it?).
If the DFM file is the problem, and is corrupted, rolling back will have to be a roll-back WAY back, and that's gonna be expensive. Given that the IDE can still load it, is there any utility that can clean up the file?
Or, am I totally off base w/the DFM as primary suspect?
Thanks folks for the input. Forgot about the binary/text options w/DFM files, so that was helpful. It looks like the DFM itself is not corrupted.
Still having the EClassError issue though. re: It being missing property values, or referencing non-existing properties, etc., a further question: Is the class the error is given for (currently TnxSqlUpdateObject, but probably more waiting in the wings if experience thus far is consistent) usually/always the actual "culprit" class/object?
For instance, right now my main form has four references to TnxSqlUpdateObject, w/those actually dropped on the form. If I put RegisterClass(TnxSqlUpdateObject) in the initialization section, it runs fine for that EClassNotFound error but then goes on to the next one (in this case, TStringField).
I have reinstalled the NexusDB components in this case, and also built a new project using some of the components I thought might be the problem. It compiles and runs fine, UNTIL I add this other form from my real project (which, in turn, unfortunately references quite a few others).
SO, it sounds like my real issue is how to methodically diagnose and fix any and all EClassNotFound errors?
I get this error if a component is on the form, but doesn't have an entry in the form definition in the source file too. Most often when I've copied and pasted from another form. Simplest solution is to select the component, cut it, then paste it back. When you save, the component's unit will be added to the source, and when you run it again it will all be okay.
Well, a dfm file could be binary or tekst (as I'm correct from version 4.0).
You can check this by right click on the form and check the Text DFM flag.
If a dfm file is corrupt, tou can try to fix it by removing all suspicious lines.
Be sure to leave the object .. end sets intact and you probably only loose some property values.
By the way, the dfm file should look like this (to get an idea of the general structure):
object Form5: TForm5
Left = 0
DesignSize = (
426
652)
object Button1: TButton
Left = 343
end
object Memo2: TMemo
Anchors = [akLeft, akTop, akRight, akBottom]
end
end
If it does not look like that you are probably editing the binary file.
If you have a recent compiled exe that works, you can use a resource-editor, like PE Explorer, to get the dfm-definition. Then you can compare the one from the exe with the one that you now have.
I believe there is tools to convert binary dfm-files to text-files too. This will give you a better view on the file, and help you decide if it's really corrupted or not. I see Felix has something on the topic.
If the Delphi IDE shows the form ok without errors, I can't believe there is a corruption-error. Could there be a package problem? Do you use runtime-packages?
Update:
Hvae you tried Eurekalog or madExcept or something similar to get a more detailed error message with callstack and memorydumt? Maybe that will give you some clue about the problem.
But generally i think this error comes from missing runtime package, or a missing unit in the uses-clause. If you think you know witch component causes the error, search the source for the call to RegisterClass( ), and see if that unit somehow is included in the projcets uses-clause. If not, add it and try again.
If you can load the form in the Delphi IDE the DFM resource is not corrupted. Delphi uses the same code to load the DFM as the final executable will use, so I think that won't be the reason.
You can open the DFM in the Delphi IDE directly (if the corresponding pas file is not open), or you can use Alt+F12 to switch between form view and text view of the DFM. In this view the structure should be sane, with correct indentation and so on.
As Gamecat pointed out you can use the command in the form popup menu to toggle the DFM storage format. Leave it as text for Delphi 5+, it works better this way with SVN.
As for the cause of your runtime problem - I have no idea...
Edit: After your ruling out the DFM as the source of the problem I can only assume that an important unit in the uses list is missing, which can only happen if not all the components on your form have a corresponding member field. You should check that all the components referenced in the DFM are also in the form, even when you do not access them in your code. This will in turn cause Delphi to add any missing units to the uses clause when the file is saved. Manually registering components should not be necessary if the form class has references to all the components in the DFM.
For a quick check you could create a test form, drop all of the components that your "problem" form has onto it (one instance is enough), and check whether this works.
This can happen in case you have changed one of your custom components and removed a property from it. The property is stil in the DFM and Delphi tries to initialize it.
Try to remove manually parts from your DFM so you can pinpoint which component is causing the problem.
Try this:
Make backup first
Right click on form in designer; uncheck "Text DFM"
Save
Right click on form in designer; check "Text DFM"
Save

Resources