Bueno, me voy. Luego vuelvo. Os dejo el código de lo que he conseguido hasta ahora.
Objetos:
Código Delphi
[-]object Form1: TForm1
Left = 302
Top = 239
Width = 676
Height = 426
Caption = 'Editor de texto'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnCanResize = FormResize
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object RichEdit: TRichEdit
Left = 0
Top = 0
Width = 665
Height = 353
TabOrder = 0
OnChange = RichChange
end
object StatusBar1: TStatusBar
Left = 0
Top = 353
Width = 668
Height = 19
Panels = <
item
Width = 50
end
item
Text = 'Escribe arriba lo que desees.'
Width = 50
end>
end
object SaveDialog1: TSaveDialog
DefaultExt = 'txt'
FileName = 'prueba'
Filter = 'Archivos de texto|*.txt|Scripts|*.scp'
Left = 32
Top = 40
end
object MainMenu1: TMainMenu
Left = 72
Top = 40
object N1: TMenuItem
Caption = 'Archivo'
Default = True
object Guardar1: TMenuItem
Caption = 'Guardar'
OnClick = Guardar1Click
end
end
end
end
Programa:
Código Delphi
[-]program edittxt;
uses
Forms,
editortextos in 'editortextos.pas' ;
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Unidad:
Código Delphi
[-]unit editortextos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, Menus;
type
TForm1 = class(TForm)
RichEdit: TRichEdit;
StatusBar1: TStatusBar;
SaveDialog1: TSaveDialog;
MainMenu1: TMainMenu;
N1: TMenuItem;
Guardar1: TMenuItem;
procedure FormResize(Sender: TObject; var NewWidth, NewHeight: Integer;
var Resize: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Guardar1Click(Sender: TObject);
procedure RichChange(Sender: TObject);
private
public
end;
var
Form1: TForm1;
cambiado: boolean;
implementation
{$R *.dfm}
procedure TForm1.FormResize(Sender: TObject; var NewWidth,
NewHeight: Integer; var Resize: Boolean);
begin
RichEdit.Width:=form1.Width - 9 ;
RichEdit.Height:=form1.height - 73
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if cambiado = true then
form1.SaveDialog1.Execute;
end;
procedure TForm1.Guardar1Click(Sender: TObject);
begin
Showmessage('Próximamente jaj');
end;
procedure TForm1.RichChange(Sender: TObject);
begin
cambiado:=true
end;
end.