SRL Archive - Research & Development Lounge

SCAR Notepad


Da 0wner

2008-03-30 16:37:17

This is a little project i'm going to work on for a few days/weeks.

What it has so far

Resizable
Color/Size/Font changing
Open/Save

What i'm planning to add

SCAR Syntax highlighting
Underline compiling errors.

So just download and press play. Post suggustions.

mixster

2008-03-30 16:49:43

Uggh, the standards, they burn :eek:
Other than that, it's a pretty cool Scar notepad, though I've made a Delphi version so I was disappointed to not find a few of the more useful options. Also, I don't think you can change the font for only selected text unless you made it dynamically create memo's yo store the text and then changed only that, though I think that could mess up the view. Maybe try and find a Delphi way of doing it and seeing if that works with Scar - that's what I always do.
Edit: I just realised this, but why would you want to code in a notepad inside scar when you could just code in scar? It's a mini-paradox I say!

Da 0wner

2008-03-30 16:52:55

yea my standards suck. Can you give me some suggustions pl0x. And you changed your name :)

Hobbit

2008-03-30 16:56:49

Maybe if you get the SCAR syntaxing figured out, make it optional..

nielsie95

2008-03-30 16:58:04

If you want to change the style of the selected text only, use a TRichEdit. You can change the selection with SelAttributes.

Da 0wner

2008-03-30 16:58:38

Ty nielse :) credits for you

edit: but i can't get a scrollbar to go on a trichedit what do i use on that.

Dan Cardin

2008-03-30 17:01:56

as far as i know, you cant do the font thing(ive tried). and my syntax highlighter, doesnt work yet so, i cant help you with that either :p.

i dont want to give you too many suggestions, because if you look in my sig…:p

EDIT: as for scrollbar on trichedit - i requested freddy to add it into 3.15 and it is, you need
    hidescrollbars := false;
scrollbars := ssvertical;


and it doesnt matter, the fonts attribute for trichedit, isnt for the words its for the whole thing

nielsie95

2008-03-30 17:08:22


program New;
var
MainForm: TForm;

procedure InitForm;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal;
SelStart := Length('hello there ') + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold];
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.

Da 0wner

2008-03-31 03:52:04

nielse i tried doing what you said but this dosent work when i change what the font is


RichEdit1.SelAttributes.Name := FontDialog1.Font.Name;

what chagnes the type of font? etc arial, times new roman

Dan Cardin

2008-03-31 07:06:26

trichedit.font.Name is what changes the font. but like i said, all it does is change the font for the whole thing.

I bet you could install a component in delphi and plugin-it in to scar though(i just dont know how to :().

nielsie95

2008-03-31 09:01:09


program New;
var
MainForm: TForm;

procedure InitForm;
var
f: TFont;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal; //Change color
SelStart := SelStart + SelLength + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold]; //Set bold
SelStart := SelStart + SelLength + 1;
SelLength := Length('456');
f := TFont.Create;
f.Name := 'courier new'; //Change font
SelAttributes.Assign(f);
f.Free;
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.

Because SCAR doesn't have the name property in SelAttributes you have to do it this way.

If you use a TFontDialog, you don't need the extra variable:


program New;
var
MainForm: TForm;

procedure InitForm;
begin
MainForm := CreateForm;
MainForm.Width := 400;
MainForm.Height := 400;
MainForm.Caption := 'MainForm';
MainForm.Color := clBtnFace;
MainForm.BorderIcons := [biSystemMenu];
MainForm.BorderStyle := bsSingle;
MainForm.Font.Color := clWindowText;
MainForm.Font.Height := -11;
MainForm.Font.Name := 'MS Sans Serif';
MainForm.Font.Style := [];
MainForm.PixelsPerInch := 96;

with TRichEdit.Create(MainForm) do
begin
Parent := MainForm;
Align := alClient;
ScrollBars := ssBoth;
HideScrollBars := False;
Text := 'hello there '+Chr(13)+'123'+chr(13)+'456';
SelStart := 0;
SelLength := Length('hello there ');
SelAttributes.Color := clTeal;
SelStart := SelStart + SelLength + 1;
SelLength := Length('123');
SelAttributes.Style := SelAttributes.Style + [fsBold];
SelStart := SelStart + SelLength + 1;
SelLength := Length('456');
with TFontDialog.Create(MainForm) do
begin
if Execute then
SelAttributes.Assign(Font);
Free;
end;
SelLength := 0;
end;
end;

procedure ShowFormModal;
begin
MainForm.ShowModal;
end;

var
v: TVariantArray;
begin
v := [];
ThreadSafeCall('InitForm', v);
ThreadSafeCall('ShowFormModal', v);
FreeForm(MainForm);
end.

Notice how you can set pretty much everything at once with the assign procedure in combination with a TFont?

ShowerThoughts

2008-03-31 10:33:48

Why would you use a scar notepad?

Dumpin

2008-03-31 13:45:22

because it owns? and you could always add your own cool stuff to it aye? :D

Da 0wner

2008-04-09 23:15:41

ehh, can anyone post any suggustions i can make anything you need….? and this isn't current version still working on my alpha version (not beta) i won't release until beta so you guys test. but dan is already working on and it's pretty cool so far :)

nielsie95

2008-04-10 02:27:54

Did it work out with the font style for the selected text?

Da 0wner

2008-04-10 03:05:49

yep it did nielse thanks :) i added a lot more stuff but its not released yet :). the uploaded one is teh shizzy 1