Why code hint does not appear in Delphi XE3? - delphi

I am using Delphi XE3 to develop a FireMonkey application. In the past, there is a code hint function, so that when I complete the name of a form, like this:
MainForm.
When I type the ., the IDE pops up a list of the functions and properties in the MainForm object. However, today I find such a function suddenly disappeared. Therefore, I wonder how to re-enable such a function again.

Related

Delphi - How to correctly register a graphic class since XE8?

I'm writing a Delphi package, which provides a new custom TGraphic object, allowing to read a new image format in VCL components like TImage.
I originally developed this package with RAD Studio XE7, and it worked well. However I migrated recently to a newer RAD Studio compiler version, and although my package continues to work properly on that new version, I noticed a strange bug that never appeared before.
I have a form with several components, some of them are TImage components. Immediately after opening the IDE, the first time I open my project in design time, all the TImage components containing my custom TGraphic component loose their content. If I close then reopen the project, the images reappear, and the bug no longer happen until I close and reopen my IDE.
I dug in my code to understand what may cause the issue. To register my custom TGraphic component, I use the class initialization section, in which I wrote the following code:
initialization
begin
Vcl.Graphics.TPicture.RegisterFileFormat('svg', 'Scalable Vector Graphics', TWSVGGraphic);
end;
However I found that, since the XE8 compiler version, the TImage constructor is called before my initialization section, causing thus apparently the above mentioned issue. All the compiler versions since XE8 are affected, but this bug never happened on XE7 or earlier. So something changed since XE8.
Here are my questions:
Is the way I use for register my custom graphic class correct?
If not, what is the correct way to do that?
As something seems different since XE8, what it the new correct manner to register my graphic component?
Did anyone else faced the same issue? How he resolved it?
Is this may be a new RAD Studio bug, or the issue is rather on my side?
This is most likely a side effect of the smart loading the IDE applies to design time packages. You can overwrite this behavior by calling ForceDemandLoadState(dlDisable) during the Register procedure of your package.
More about this can be found in the documentation of more recent versions of Delphi than XE8: Explicitly disabling smart loading of components in a design-time package

Why does DragAcceptFiles not work on the TEdit controls of the Tool Properties dialog in Delphi >=2005?

I am trying to make the TEdit control for the program on the "Tool Properties" dialog in the Delphi IDE (*1) accept dropping files from the explorer. This works fine in Delphi 6 and 7 but no longer works in the "new" IDE of Delphi 2005 up.
In Delphi 6/7 dropping a file on the edit control triggers a WM_DROPFILES message which a hook to the WindowProc of the TEdit can catch. In the later versions, no message is received. The hook on WindowProc still works, as it receives all kinds of other messages.
The dialog layout, names and controls is unchanged as far as I can determine.
As a test I even added my own TEdit and TComboBox to the dialog to make sure it's not a problem of these specific existing controls. They are shown fine, but dropping a file doesn't work with these either.
What else could be the problem?
(*1: the one you get through Tools -> Configure Tools -> Add or Edit
This will be a new functionality in GExperts. Auto complete already works for these controls.)
The code is here:
http://sourceforge.net/p/gexperts/code/HEAD/tree/trunk/Source/IDE/GX_IdeToolPropertiesEnhancer.pas
and the actual hooking code is here:
http://sourceforge.net/p/gexperts/code/HEAD/tree/trunk/Source/Utils/GX_dzVclUtils.pas

Delphi TPageControl trouble in dll

I am coding up a VST plugin dll. I have no trouble with the plugin until I use a PageControl and place controls on it.
Specifically, my dll seems to have trouble receiving mouse clicks if the control I click on is in a tabsheet, and has code to execute in a mouse onclick or onChange event. However, this ONLY occurs when the hosting program gives control back to my plugin. I can interact perfectly fine with the plugin before the hosting program implements the settings I select, but once it tries to hand back control, I can only click on, seemingly, any control that does not implement any written mouse event code (Tlabel clicks are fine, tabsheet changes are fine too).
The plugin works fine as long as I don't try to make changes to the settings through the controls after the hosting program hands back control to the dll. I can use the same settings over and over again with no problem. I can change them as much as I want until I let the hosting program implement the plugin values (which works perfectly).
This is really tricky to debug since the program is in a dll.
I have tried using Delphi XE2 and Delphi 2009.
Any clues?

How do I get TWebBrowser in Delphi XE2 to run?

The TWebBrowser component in Delphi XE2 seems to be seriously buggy. Is there some sort of code I have to run in order to instantiate it in some special way?
Create new Delphi project
Drop a TWebBrowser component onto the form.
In Form1.FormCreate() call WebBrowser1.GoHome (to google).
If I compile this 32-bit and go to some specific webpages I get error messages.
google (ncbi nucleotide blast) and click the first link.
In addition to these javascript errors if I click a link which usually opens in a new window, it opens in IE (a separate application).
The 64-bit version seems even more broken. By going to that same site (ncbi nucleotide blast) I get the entire program crashing due to a 'divide_by_zero' error.
Regarding the floating point exceptions, TWebBrowser expects to operate with floating point exceptions masked. It looks like you are using Delphi default floating point settings and have exceptions unmasked. I suspect that if you mask exceptions then your problems will disappear.
Do that like so:
SetExceptionMask(exAllArithmeticExceptions);
And as others have said, you silence the Javascript popups by setting Silent to True.

One project in Delphi 2007 doesn't show procedure name in the IDE Obj Inspector's Events

I have a Delphi project in 2007 that doesn't show the procedure names in the Object Inspector's Events such as Form OnClose, OnCreate or OnShow in the IDE. The code is there and if you click on OnCreate (for example) you are taken to the code and the IDE fills in the name of procedure. However on reload, the procedures are missing from the IDE again.
This same project causes various error messages when Delphi closes also, but I am not sure if this is related (no other project developed under this Delphi does but this one is the largest app and uses several 3rd party add-in libraries).
I have moved this app to various Delphi 2007 installations and it reacts the same, so it isn't a corrupt Delphi situation. Is there any way to rebuild or fix a corrupt project like this? Any help would be appreciated.
I would try to remove all the files and keep only the dpr and the pas/dfm files in case it's a corrupted project file.
I would also double check if there is any Form inheritance mess, as I have seen somewhat similar issues with the inherited event handlers. (look at the dfm files directly)
Try delete all the .DCU's, close Delphi, restart Delphi then rebuild your project.
Delphi's IDE takes several liberties with your code without warning you.
In particular : if you have a callback (eg: "TMyForm.FormCreate") linked in the dfm, and the IDE detects that the function's body is empty, when you save your unit, the ide removes the declaration and the implementation before saving your file.
Adding anything (even a simple "//") in the function's body prevents this : try typing some code or some comment in your function before closing your Delphi.
As for errors when Delphi closes, there can be so many reasons.
Do you have any third-party components or experts installed ?
Have you tried installing IDEFixpack for D2007 ?

Resources