BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dockable IDE form persistence issue

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI
View previous topic :: View next topic  
Author Message
Christian Wilkerson
Guest





PostPosted: Tue Nov 21, 2006 4:33 am    Post subject: Dockable IDE form persistence issue Reply with quote



Ok, I am stumped. I can create a form and embed it within the IDE, and it
looks great. But try as I might, I just can't seem to get it saved to the
desktop. I've distilled it down to the simplest of code. It's simply a
form with a Label on it that says "Hello World." I feel like I'm just a
line or two of code away from having this work. Can anybody help?

TIA,

-Christian

unit cwHelloWorld;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DockToolForm, DeskUtil, DeskStrs, IniFiles;

type
TfHelloWorld = class(TDockableToolbarForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;

procedure LoadWorld(DeskFile: TCustomIniFile);

procedure SaveWorld(DeskFile: TCustomIniFile; IsProject: boolean);

procedure Register;

var
fHelloWorld: TfHelloWorld;

implementation

{$R *.dfm}

procedure Register;
begin
if fHelloWorld = nil then
fHelloWorld := TfHelloWorld.Create(Application);
fHelloWorld.Show;

RegisterDesktopFormClass(TfHelloWorld, fHelloWorld.Name,
fHelloWorld.Name);
if @RegisterFieldAddress <> nil then
RegisterFieldAddress(fHelloWorld.Name, @fHelloWorld);
RegisterDesktopProcs(LoadWorld, SaveWorld);
end;

procedure LoadWorld(DeskFile: TCustomIniFile);
var
AStringList: TStringList;
begin
// Just trying to see if this even gets called
AStringList := TStringList.Create;
try
AStringList.Text := 'loading ' + DeskFile.FileName;
AStringList.SaveToFile('C:\Program
Files\Borland\BDS\4.0\Bin\LoadWorld.txt');
finally
AStringList.Free;
end;
end;

procedure SaveWorld(DeskFile: TCustomIniFile; IsProject: boolean);
var
AStringList: TStringList;
begin
// Just trying to see if this even gets called
AStringList := TStringList.Create;
try
AStringList.Text := 'saving ' + DeskFile.FileName;
AStringList.SaveToFile('C:\Program
Files\Borland\BDS\4.0\Bin\SaveWorld.txt');
finally
AStringList.Free;
end;
end;

initialization
finalization
begin
fHelloWorld.Free;
end;

end.
Back to top
Christian Wilkerson
Guest





PostPosted: Tue Nov 21, 2006 7:28 am    Post subject: Re: Dockable IDE form persistence issue Reply with quote



I should add that I'm using Delphi 2006. And just a few minutes ago tried
the DockingFormDelphi example from the GExperts page. While there are
differences, I still get the same behavior. Except here, the .dst file does
seem to store information about the form. However, on restarting Delphi, no
form.

-Christian

"Christian Wilkerson" <cpwilkerson (AT) no (DOT) spamming.charter.net> wrote in message
news:45622d10$1 (AT) newsgroups (DOT) borland.com...
Quote:
Ok, I am stumped. I can create a form and embed it within the IDE, and it
looks great. But try as I might, I just can't seem to get it saved to the
desktop. I've distilled it down to the simplest of code. It's simply a
form with a Label on it that says "Hello World." I feel like I'm just a
line or two of code away from having this work. Can anybody help?

TIA,

-Christian

unit cwHelloWorld;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
Forms,
Dialogs, StdCtrls, DockToolForm, DeskUtil, DeskStrs, IniFiles;

type
TfHelloWorld = class(TDockableToolbarForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;

procedure LoadWorld(DeskFile: TCustomIniFile);

procedure SaveWorld(DeskFile: TCustomIniFile; IsProject: boolean);

procedure Register;

var
fHelloWorld: TfHelloWorld;

implementation

{$R *.dfm}

procedure Register;
begin
if fHelloWorld = nil then
fHelloWorld := TfHelloWorld.Create(Application);
fHelloWorld.Show;

RegisterDesktopFormClass(TfHelloWorld, fHelloWorld.Name,
fHelloWorld.Name);
if @RegisterFieldAddress <> nil then
RegisterFieldAddress(fHelloWorld.Name, @fHelloWorld);
RegisterDesktopProcs(LoadWorld, SaveWorld);
end;

procedure LoadWorld(DeskFile: TCustomIniFile);
var
AStringList: TStringList;
begin
// Just trying to see if this even gets called
AStringList := TStringList.Create;
try
AStringList.Text := 'loading ' + DeskFile.FileName;
AStringList.SaveToFile('C:\Program
Files\Borland\BDS\4.0\Bin\LoadWorld.txt');
finally
AStringList.Free;
end;
end;

procedure SaveWorld(DeskFile: TCustomIniFile; IsProject: boolean);
var
AStringList: TStringList;
begin
// Just trying to see if this even gets called
AStringList := TStringList.Create;
try
AStringList.Text := 'saving ' + DeskFile.FileName;
AStringList.SaveToFile('C:\Program
Files\Borland\BDS\4.0\Bin\SaveWorld.txt');
finally
AStringList.Free;
end;
end;

initialization
finalization
begin
fHelloWorld.Free;
end;

end.
Back to top
Christian Wilkerson
Guest





PostPosted: Tue Nov 21, 2006 9:12 am    Post subject: Re: Dockable IDE form persistence issue Reply with quote



Ok, so here's what I found. First, I got it working. Many thanks actually
to the sample from the GExperts page. It got me pretty much the rest of the
way. I post this just in case somebody else has the same question, as well
as, for those people who like to know the ending of the story.

Lastly, I think this an alright bare bones sample.

-Christian

unit cwHelloWorld;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DockToolForm, DeskUtil, DeskStrs, IniFiles;

type
TfHelloWorld = class(TDockableToolbarForm)
Label1: TLabel;
private
{ Private declarations }
public
constructor Create(AOwner: TComponent);
destructor Destroy; override;
end;

procedure Register;

var
fHelloWorld: TfHelloWorld;

implementation

{$R *.dfm}

procedure Register;
begin
if fHelloWorld = nil then
fHelloWorld := TfHelloWorld.Create(Application);
fHelloWorld.Show;

RegisterDesktopFormClass(TfHelloWorld, fHelloWorld.Name,
fHelloWorld.Name);
if @RegisterFieldAddress <> nil then
RegisterFieldAddress(fHelloWorld.Name, @fHelloWorld);
end;

constructor TfHelloWorld.Create(AOwner: TComponent);
begin
inherited;
DeskSection := Name;
AutoSave := True;
SaveStateNecessary := True;
end;

destructor TfHelloWorld.Destroy;
begin
SaveStateNecessary := True;
inherited;
end;

initialization
finalization
begin
fHelloWorld.Free;
end;

end.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.