Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2 Tokyo


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Mar 29, 2017 9:22 AM Last Post By: Remy Lebeau (Te...
Alexandre Machado

Posts: 1,754
Registered: 8/10/13
IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2 Tokyo  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 28, 2017 2:25 AM
I have a Project Creator class which implements IOTAProjectCreator160.

I have a simple GetFrameworkType method which is:

function TMyProjectCreator.GetFrameworkType: string;
begin
  Result := 'VCL';
  ShowMessage(Result);
end;


As you can imagine, ShowMessage() is never called in Delphi 10.2 Tokyo. In Berlin, Seattle and all others, it works as expected.

When I create a new project using it in Delphi 10.2 Tokyo, I receive the usual message saying that I don't have an associated framework:


Confirm

Unit "Unit1.pas" references the "Visual Component Library" framework, but the project currently has no framework assigned. Do you want to enable the "Visual Component Library" framework for this project?

(Not enabling the proper framework may require unit scoping, ambiguities, and linkage to framework binaries to be handled manually)

Yes No Cancel

Can someone confirm this as a Delphi 10.2 bug?

Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2 Tokyo [Edit]
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 28, 2017 8:00 AM   in response to: Alexandre Machado in response to: Alexandre Machado
Alexandre Machado wrote:

I have a Project Creator class which implements IOTAProjectCreator160.

I have a simple GetFrameworkType method which is:

function TMyProjectCreator.GetFrameworkType: string;
begin
  Result := 'VCL';
  ShowMessage(Result);
end;


As you can imagine, ShowMessage() is never called in Delphi 10.2
Tokyo. In Berlin, Seattle and all others, it works as expected.

When I create a new project using it in Delphi 10.2 Tokyo, I receive
the usual message saying that I don't have an associated framework:

Confirm

Unit "Unit1.pas" references the "Visual Component Library" framework,
but the project currently has no framework assigned. Do you want to
enable the "Visual Component Library" framework for this project?

(Not enabling the proper framework may require unit scoping,
ambiguities, and linkage to framework binaries to be handled
manually)
Yes No Cancel

Can someone confirm this as a Delphi 10.2 bug?


I have no sample to test, but maybe if you also add the
IOTAProjectCreator190 interface?
Alexandre Machado

Posts: 1,754
Registered: 8/10/13
Re: IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2 Tokyo [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 28, 2017 1:35 PM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Lajos Juhasz wrote:
Alexandre Machado wrote:

I have a Project Creator class which implements IOTAProjectCreator160.

I have a simple GetFrameworkType method which is:

function TMyProjectCreator.GetFrameworkType: string;
begin
  Result := 'VCL';
  ShowMessage(Result);
end;


As you can imagine, ShowMessage() is never called in Delphi 10.2
Tokyo. In Berlin, Seattle and all others, it works as expected.

When I create a new project using it in Delphi 10.2 Tokyo, I receive
the usual message saying that I don't have an associated framework:

Confirm

Unit "Unit1.pas" references the "Visual Component Library" framework,
but the project currently has no framework assigned. Do you want to
enable the "Visual Component Library" framework for this project?

(Not enabling the proper framework may require unit scoping,
ambiguities, and linkage to framework binaries to be handled
manually)
Yes No Cancel

Can someone confirm this as a Delphi 10.2 bug?


I have no sample to test, but maybe if you also add the
IOTAProjectCreator190 interface?

I will add that interface as well, however I don't see any change in that interface that could cause this... Also, in Berlin, without that interface, it works. This is weird and sounds like a genuine bug.
I'll report my results later.

Thank you!
Alexandre Machado

Posts: 1,754
Registered: 8/10/13
Re: IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2 Tokyo  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 28, 2017 10:56 PM   in response to: Alexandre Machado in response to: Alexandre Machado
Reference for future readers:

In Delphi 10.2 Tokyo you must implement IOTAProjectCreator190 interface and method GetSupportedPlatforms. Looks like, if IOTAProjectCreator190.GetSupportedPlatforms is not implemented, the IDE will never call IOTAProjectCreator160.GetFrameworkType, so you must have:


{ from IOTAProjectCreator190 interface}
 
function TMyProjectCreator.GetSupportedPlatforms: TArray<string>;
begin
  Result := TArray<string>.Create(cWin32Platform, cWin64Platform);
end;
 
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: IOTAProjectCreator160.GetFrameworkType never called in Delphi 10.2Tokyo  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 29, 2017 9:22 AM   in response to: Alexandre Machado in response to: Alexandre Machado
Alexandre wrote:

Looks like, if IOTAProjectCreator190.GetSupportedPlatforms is not
implemented, the IDE will never call IOTAProjectCreator160.GetFrameworkType

Sounds like a bug to me. Did you file a QP report yet? IOTAProjectCreator160
even has a GetPlatforms() method, so it should have been trivial for the
IDE to do something like this:

var
  Creator: IOTAProjectCreator;
  Creator160: IOTAProjectCreator160;
  Creator190: IOTAProjectCreator190;
  Platforms: TArray<string>;
begin
  Creator := ...;
  if Supports(Creator, IOTAProjectCreator190, Creator190) then
    Platforms := Creator190.GetSupportedPlatforms
  else
  if Supports(Creator, IOTAProjectCreator160, Creator160) then
  begin
    Platforms := Creator160.GetPlatforms;
    if Platforms = nil then
    begin
      if Creator160.GetFrameworkType = 'VCL' then
        Platforms := TArray<string>.Create(cWin32Platform, cWin64Platform)
      else
        Platforms := TArray<string>.Create(cWin32Platform, cWin64Platform, 
cOSX32Platform, ciOSDevice32Platform, ciOSDevice64Platform, cAndroidPlatform, 
cLinux64Platform);
    end;
  end
  else
    Platforms := nil;
  ...
end;


--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02