Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Delphi]Making a notepad

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Aug 22, 2007 1:26 pm    Post subject: [Delphi]Making a notepad Reply with quote

ok i only need to fix these ptoblems and im done...

open and save..

if openDialog.Execute then
RichEdit1.Text := openDialog.what.to.type.here.so.this.will.open.the.file?; use ReadFile? :O

and save

i save the file as a txt but i save nothing... it doesnt save anything becuase i didnt tell delphi what to save... how can i tell delphi to save RichEdit1.Text?

and how do i do Form1.Caption := save/openDialog.umm.what + ' - Notepad'?

sorry for all the questions thx Smile
Back to top
View user's profile Send private message
XTrinityX
Expert Cheater
Reputation: 0

Joined: 18 May 2006
Posts: 123
Location: Connecticut

PostPosted: Wed Aug 22, 2007 2:00 pm    Post subject: Reply with quote

First of all, delphi has a notepad component. Search for it on the internet. However, since your questions are kinda useful to answer, I will answer them.

I don't have delphi installed / opened but I believe the procedures LoadFromFile and SaveToFile exist. (or something of the sort).
So for open, it would be.
Code:
If OpenDialog.Execute then
begin
RichEdit.Lines.LoadFromFile(OpenDialog.FileName);
end;


For save...
Code:
If SaveDialog.Execute then
begin
RichEdit.Lines.SaveToFile(SaveDialog.FileName);
end;


For the form text, you need to extract the actual file name from the long file name. You will need to include StrUtils in your uses list to use this way. (Or you can come up with your own way to do so.)
Code:
var
TheFileName : string;
i : integer;
begin
TheFileName = OpenDialog.FileName;
i = TheFileName.Length - 1;
while i > 0
if (TheFileName[i] = "/") or (TheFileName[i] = "\") then
begin
Form1.Text = (MidStr(TheFileName,(i+2)) + " - Notepad");
i = 1;
end;
i = i - 1;
end;


Again, I don't have delphi open, so these may not be exactly right.
Back to top
View user's profile Send private message AIM Address
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Wed Aug 22, 2007 2:06 pm    Post subject: Reply with quote

thx gonna try it =)

edit: yea it works! =)
this notepad sux... its like buggy and ugly :O
u said there's a notepad component? ill google it see what i can find...
umm 1 more question if u dont mind to answer :O
the keys all messed up, end changed the lagnuage, home acts like end, single click highlights text... =\ can be fixed? :]

umm the 3rd code, the title... i fixed everything and now i have nothing to fix and it doesnt work it says missing operator at "if" below while i > 0
Back to top
View user's profile Send private message
MadDoom
Cheater
Reputation: 0

Joined: 27 Dec 2006
Posts: 38

PostPosted: Thu Aug 23, 2007 1:40 am    Post subject: Reply with quote

XTrinityX wrote:

Code:
var
TheFileName : string;
i : integer;
begin
TheFileName = OpenDialog.FileName;
i = TheFileName.Length - 1;
while i > 0
if (TheFileName[i] = "/") or (TheFileName[i] = "\") then
begin
Form1.Text = (MidStr(TheFileName,(i+2)) + " - Notepad");
i = 1;
end;
i = i - 1;
end;


this is realy long way to do that.

here is a better way:
Code:

form1.caption:=ExtractFileName(opendialog.FileName)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites