Search the Community
Showing results for tags 'rfc'.
Found 1 result
-
I'm currently experimenting with the ToolsAPI.WelcomePage API a bit and created a plugin for the GExperts favorites. My current work is a bit hacky, therefore there is currently no patch or something. I include the ToolsAPI.WelcomePage unit in the GX_FavFiles and have a separate type for the plugin there: TGXWelcomePagePlugin = class(TInterfacedObject, INTAWelcomePagePlugin, INTAWelcomePageContentPluginCreator) private FIconIndex: Integer; FView: TFrame; FFavoriteFilesExpert: TFavoriteFilesExpert; public constructor Create(const AFavoriteFilesExpert: TFavoriteFilesExpert); destructor Destroy; override; { INTAWelcomePagePlugin } function GetPluginID: string; function GetPluginName: string; function GetPluginVisible: Boolean; { INTAWelcomePageContentPluginCreator } function GetView: TFrame; function CreateView: TFrame; procedure DestroyView; function GetIcon: TGraphicArray; function GetIconIndex: Integer; procedure SetIconIndex(const Value: Integer); end; The AfterIDEInitialized procedure calls the creation of the plugin via the RegisterWelcomePage method. This does not work on first try, so there is a timer to catch the moment the WelcomePagePluginService is finally availabe. If anyone knows of a different way to register the plugin, please let me know! A dedicated, global "Register" procedure as used for BPL-Plugins didn't work. procedure TFavoriteFilesExpert.RegisterWelcomePage(Sender: TObject); begin // The WelcomePagePluginService might not be initialized the first time we get here, // so try again at a later time. if not Assigned(WelcomePagePluginService) then begin if (not Assigned(FPluginTimer)) then begin FPluginTimer := TTimer.Create(nil); FPluginTimer.OnTimer := RegisterWelcomePage; FPluginTimer.Interval := 2000; end; FPluginTimer.Enabled := True; end else begin FPluginTimer.Enabled := False; if (Assigned(FPluginTimer)) then FreeAndNil(FPluginTimer); WelcomePagePluginService.RegisterPluginCreator(TGXWelcomePagePlugin.Create(Self)); end; end; The welcome page gets the favorites expert as a parameter to be able to access the options (it may be sufficient to just pass the options). Then in the CreateView method I create a TfmFavFiles form and "steal" the tvFolders and pnlFiles objects and change the parent to the plugin view. function TGXWelcomePagePlugin.CreateView: TFrame; var FavFiles: TfmFavFiles; begin if not Assigned(FView) then begin FView := WelcomePagePluginService.CreateCaptionFrame(sPluginID, sPluginName, nil); FavFiles := TfmFavFiles.Create(nil, FFavoriteFilesExpert.FOptions); FavFiles.tvFolders.Parent := FView; FavFiles.pnlFiles.Parent := FView; end; Result := FView; end; This works form me, but is not in a state that I would like to upstream the work, so any input is greatly appreciated!