Solved

how to save a file and retrieve

Posted on 1998-04-05
3
167 Views
Last Modified: 2010-04-06
i got a hard time saving a text with assign properties like the color, the font size, and the font style that when i retrieve it again the assign properties of the last file i save will be applied to the file that i retrieve. can anybody help me.
0
Comment
Question by:kabae
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
extreme earned 100 total points
ID: 1361301
Well, you don't specified if you are using TRichEdit or what to format the text. I'll
suppose you are using TRichEdit, and maybe you are using SaveToFile to save the file to
disk. I such a case if you are not having the text formatted when retrieving the text again
then that could be because you have the PlainText property setted to true in the TRichEdit
object. Try setting the PlainText property to false, and use the methods SaveToFile and LoadFromFile of the Lines property to save and retrieve your text. That works saving the text in RTF format.
0
 

Author Comment

by:kabae
ID: 1361302
to extreme
this is a sample program that im working. Can you do this the right way coz im new in delphi programming.
im trying the savetofile method together with a timage with it i cant find a way to do it. plz help me.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, LblEffct, Buttons, aprstore, sDialogEx, oDialogEx;

type
  TfAutoPropStore = class(TForm)
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Button4: TButton;
    FontD: TFontDialog;
    OpenD: TOpenDialogEx;
    SaveD: TSaveDialogEx;
    BitBtn3: TBitBtn;
    lb1: TLabel;

    procedure BitBtn1Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fAutoPropStore: TfAutoPropStore;
    a: integer;

implementation

{$R *.DFM}


procedure TfAutoPropStore.BitBtn1Click(Sender: TObject);
VAR I:INTEGER;
    F1:FILE;
begin

IF saved.Execute THEN

BEGIN
//aps.SaveProperties;

 a :=strtoint( EDIT1.TEXT);

  ASSIGNFILE(F1,saved.FILENAME);
  REWRITE(F1,1);

I:=36;
 BLOCKWRITE(F1,a,I,I);
 CLOSEFILE(F1);

//aps.Items.Clear;
END;


end;
procedure TfAutoPropStore.Edit1Change(Sender: TObject);
begin

lb1.Caption := edit1.Text;

end;


procedure TfAutoPropStore.Button4Click(Sender: TObject);
begin
fontd.Execute;
lb1.Font := fontd.Font;
end;

procedure TfAutoPropStore.BitBtn2Click(Sender: TObject);
VAR I:INTEGER;
    F1:FILE;
begin

edit1.Text := ' ';


IF OPENd.EXECUTE THEN
BEGIN


ASSIGNFILE(F1,OPENd.FILENAME);
RESET(F1,1);
I:={10116064;55404;;}36;
BLOCKREAD(F1,a,SIZEOF(a),I);
CLOSEFILE(F1);
EDIT1.TEXT:= inttostr(a) ;

END;

end;


procedure TfAutoPropStore.FormActivate(Sender: TObject);
begin
edit1.Text := ' ';
end;


procedure TfAutoPropStore.BitBtn3Click(Sender: TObject);

begin
close;


end;

end.
0
 
LVL 1

Expert Comment

by:extreme
ID: 1361303
Did you tried the SaveToFile method of the Picture property of the TImage component?
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question