I have two forms(one main form,and one submain form).I'd like to do something like CodeGear's IDE panels on drag-and-drop.Meaning I could move them and they merge with other components.
However,I'm asking for something different:
I'd like to drag the submain form into the main form and to turn it into a something like TFrame or,in other words,something that doesn't move,but stay static.And reverse - I'd like to alo be able to get the form out of the TFrame by any chance.
Is my idea possible and if it is,could you explain how to accomplish it?
EDIT: An idea came to my head.Is it possible to create a TFrame that inherits all controls/components from a TForm so that components stay on the form,but when I attempt to turn it into Tframe,it just changes visibility to false and shows the TFrame contaning everything from the Form.Is that possible?
Set the main form's DockSite property to True, and then handle the OnDockOver and OnDockDrop events.
You can see an example of the VCL's drag and drop docking support in the Docking demo (installed for Delphi 2007 on WinXP in C:\Documents and Settings\All Users\Documents\RAD Studio\5.0\Demos\DelphiWin32\VCLWin32\Docking, for Delphi 7 in C:\Program Files\Borland\Delphi7\Demos\Docking.) Delphi 2009's will be in the same folder location as Delphi 2007's; just change the 5.0 to 6.0 in the path.
Related
Delphi sets the name of components when you add them to a form. The first TButton will be named "Button1" the second "Button2" and so on.
A while ago I discovered by accident that you can change this "prefix". Staying with TButton I changed it to "btn" so TButtons will be named "btn1", "btn2" and so on.
Now I want to change some more component prefixes but unfortunately I forgot how to do this. It could be some functionality of GExperts. Anybody to the rescue?
Just if it is important: I'm using Delphi 10.2.
In GExperts it's called "Rename Components":
http://www.gexperts.org/tour/index.html?renamecomponents.html
To get there you have to open "GExperts Configurations" and click on "Configure" button at the right side of "Rename Components":
http://www.gexperts.org/tour/index.html?gexperts_configuration.html
There is the same functionality in CnPack in "Prefix-master"
I can be wrong a little, because I prefer CnPack, but they are similar enough, I think.
I'm getting a weird error at compilation when I try to set the Parent property of a BitBtn that's been created at runtime. Using Delphi 7 on Win7 64bit.
[Error] unitMainForm.pas(70): Incompatible types: 'TWidgetControl' and
'TMainForm'
I'm creating the BitBtn at runtime like this:
newButton := TBitBtn.Create(Self);
newButton.Parent := Self;
"Self" here being the form, named "MainForm".
I'm getting this no matter what I put for a Parent. I've tried putting the current Form, ScrollBox, Panel. The same happens if I try to create a SpeedButton.
The thing is, my code works as expected when I use TButtons, and even TImages, but not with TBitBtns or TSpeedButtons. TButtons and TImages accept the Form as their parent, and show up as expected.
Any ideas?
If it helps, I could provide a sample of the whole code, upon request.
You are mixing CLX and VCL. Your button is the CLX TBitBtn, but your form is a VCL form.
I don't know whether you want your app to be a VCL app or a CLX app, but whichever it is, you need all the parts of your app to come from the same framework.
My guess is that you want a VCL app. And somehow you have used QButtons, the CLX unit, rather than Buttons, the VCL unit. And that's why you are getting the CLX version of TBitBtn.
So, assuming I'm guessing right, simply change QButtons to Buttons and your code will compile.
I am using Delphi 2010 and GExperts stable release 1.35
I am testing the "Replace Components" expert.
I add a main form and a secondary form. Each has three TEdits on it.
I use the Replace Components Expert to replace all TEdits with TRzEdit. I Check the Replace all components on all forms of the project.
It works, it replaces them all. However, it doesn't do anything to the DFM file. How do i make it replace those instances.
If i save, compile, or rebuild, i get errors.
If i try to view the form as text after replacing, i get errors.
Can someone explain to me the steps to make this work?
Thanks
I just tried it with Delphi XE and GExperts 1.35 and it does indeed crash now even after a single "Replace Selected". (It used to work fine in the past).
It seems that using the hidden menu Project | Clear Unit Cache just after Replace Components then doing a full build before trying any Save/Compile/View As Text... fixes the problem.
I think this menu is surfaced with cnPack. I don't have it and cannot guarantee, but you can easily do it yourself by adding the following unit in one of your installed packages:
unit FGEnableHiddenMenus;
interface
procedure Register;
implementation
uses
Classes, Forms, Menus;
procedure Register;
var
Comp: TComponent;
begin
//Make a hidden menu item visible
Comp := Application.MainForm.FindComponent('ProjectClearUnitCacheItem');
if Comp is TMenuItem then
TMenuItem(Comp).Visible := True;
end;
end.
Source: Brian Long's old goodies
Update:
I had to replace a couple of TEdit by TDBEdit on our main project at work and this trick worked.
But on a new Project with 3 Forms, it failed consistently to write/commit/save the changes on the last Form (same environment).
FYI, I tried with and without DDevExtensions 2.5 and IDEFixPack 4.6.1
Update2:
Went digging in the GExperts forum as suggested by Ulrich and finally found a possible explanation. The new property Touch does not like being copied from one component to another when the source is destroyed (causing the AV).
The suggested workaround is to do a bidirectional mapping in the Expert Settings to disable the copy for this property:
You might be running into this bug while trying to copy the Touch property from the old to the new component, but it has a workaround you can fairly easily test:
http://tech.groups.yahoo.com/group/GExpertsDiscuss/message/3994
Details:
There is a limitation/bug in Delphi 2010 and XE where if you assign a
Component.Touch property from one component to another and destroy the
original component that the new component becomes corrupt (it isn't
like component/interface references, where they either auto-correct
themselves or are reference counted).
For the moment, you can assign a bi-directional replace component
property map from TPanel.Touch to TGroupBox.Touch (use the two components being replaced in your specific case) that is marked as
a disabled property map, and that will work around this problem. Our next release
will not try to assign that property any longer.
GExperts 1.36 is also now available and includes a workaround for this issue. The workaround has been in the GExperts version control system and in testing for several weeks already.
I have forms in my application that I derive from a common ancestor, like:
TAtFormBaseIW = class( TIWAppForm )
and
TAtFormExplorerIW = class( TAtFormBaseIW )
This works for certain forms, but not for others.
Let me make a wild guess: it seems to work for all forms that where created in Delphi prior to IW 10, but not for forms I created with IW 10. What happens with newer forms: HWenever I want to load them into the IDE, they are interpreted as win32 forms, some properties are ignored (all typical win32 properties such as ClientWidth), and I am told that I cannot put IW components on these forms.
Making them direct descendants of TIWAppForm, saving them and using a normal text editor to change them back works. After a recompile they show up fine in the browser, but never in the IDE.
Any idea of what is happening?
Mea culpa, mea maxima culpa. This problem has nothing to do with IntraWeb, but with the way a derived form should be added to the project.
Instead of just changing TIWAppForm to TAtFormBaseIW, after having added a new form to the project, I should do this:
Select in the IDE
File / New / Other / Inheritable Items
and then the base form you want to derive your form from.
If you want to turn an existing form into a derivate, also change the leading key word object in the dfm file to inherited.
You can read about this here.
Can someone point to good delphi component that is an analogue for java JSplitPane.
I know about standard TSplitter in Delphi, but I sick and tied of using it.
The JVCL components comes with 4 splitters.
TJvSplitter
TJvxSplitter
TJvSyncSplitter
TJvNetscapeSplitter (This is very similar (visually) to JSplitPane)
Raize components has a nifty splitter: it consists of two panes (that can host other controls) and the splitter in the middle.
I've used the Plasmatech splitter in their Shell Control Pack, and like it.
http://plasmatech.com/