Author Topic: The Form Tutorial  (Read 2270 times)

Offline Dan Cardin

  • Magical Yams
  • Global Moderator
  • *****
  • Posts: 417
  • Rep: 0
  • I is am are you!
    • MSN Messenger - thelonelydingo33@hotmail.com
    • AOL Instant Messenger - YoYoPotatoTomato
    • View Profile
    • DanCardin
    • Email
The Form Tutorial
« on: January 23, 2009, 11:12:43 am »
It looks much better and niftier and neater and whatnot in the wiki, but i thought i'd make it known here.

The Form Tutorial
« Last Edit: February 18, 2009, 10:28:08 am by Dan Cardin »

Freddy1990.com

The Form Tutorial
« on: January 23, 2009, 11:12:43 am »

Offline Freddy

  • Owner
  • *****
  • Posts: 2616
  • Rep: 19
    • MSN Messenger - freddy1990@gmail.com
    • AOL Instant Messenger - Freddy199O
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #1 on: January 23, 2009, 11:49:08 am »
Looks awesome, great job!

Freddy1990.com

Re: The Form Tutorial
« Reply #1 on: January 23, 2009, 11:49:08 am »

Offline Ron

  • Full Member
  • ***
  • Posts: 163
  • Rep: 0
    • View Profile
Re: The Form Tutorial
« Reply #2 on: January 24, 2009, 07:24:03 am »
Nice job Dan! Very informative!
It doesn't get more free when you kill your facebook, twitter, and shut off your phone and meditate.

Offline Da1King

  • Leecher
  • Posts: 4
  • Rep: 0
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #3 on: January 25, 2009, 09:38:26 am »
This is a great tutorial, Nice Job!

Offline solemn wishes

  • Newbie
  • *
  • Posts: 23
  • Rep: 1
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #4 on: February 07, 2009, 07:01:56 am »
Great tutorial dan, nice explanations and detail.

Freddy1990.com

Re: The Form Tutorial
« Reply #4 on: February 07, 2009, 07:01:56 am »

Offline nielsie95

  • Administrator
  • *****
  • Posts: 465
  • Rep: 6
    • View Profile
Re: The Form Tutorial
« Reply #5 on: February 07, 2009, 10:23:59 am »
Looks good :)
Are you sure the dialogs do not work? I'm almost sure they do (at least save, open, font)..
A winner never quits, because a quitter never wins.
Heroes get remembered, legends never die.
Use what talents you possess: the woods would be very silent if no birds sang there except those that sang best.

Offline Dan Cardin

  • Magical Yams
  • Global Moderator
  • *****
  • Posts: 417
  • Rep: 0
  • I is am are you!
    • MSN Messenger - thelonelydingo33@hotmail.com
    • AOL Instant Messenger - YoYoPotatoTomato
    • View Profile
    • DanCardin
    • Email
Re: The Form Tutorial
« Reply #6 on: February 07, 2009, 11:44:33 am »
Looks good :)
Are you sure the dialogs do not work? I'm almost sure they do (at least save, open, font)..
No, its only the replace and find dialogs that either dont work, or i dont know how to work.

Freddy1990.com

Re: The Form Tutorial
« Reply #6 on: February 07, 2009, 11:44:33 am »

Offline HappyHacker

  • Leecher
  • Posts: 1
  • Rep: 0
    • View Profile
Re: The Form Tutorial
« Reply #7 on: February 15, 2009, 12:45:09 pm »
I dont understand the firstbit so i gave up plz help i wanna learn how 2 use scar

Offline Dan Cardin

  • Magical Yams
  • Global Moderator
  • *****
  • Posts: 417
  • Rep: 0
  • I is am are you!
    • MSN Messenger - thelonelydingo33@hotmail.com
    • AOL Instant Messenger - YoYoPotatoTomato
    • View Profile
    • DanCardin
    • Email
Re: The Form Tutorial
« Reply #8 on: February 15, 2009, 03:30:35 pm »
which sections specifically? some of the beginning stuff is meant to teach you about general ideas first and then you'll learn more of what it really means later on.

Offline Dan's The Man

  • Hero Member
  • *****
  • Posts: 566
  • Rep: 1
    • MSN Messenger - ip.drowner@gmail.com
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #9 on: March 19, 2009, 03:33:21 am »
I'm also positive the dialogues also work.

You just don't know how to use them properly :D

Here's an example on how to use it (didn't get enough time to finish sine i had to go to bed, but you should get the general idea):[scar]program New;

var
  frmDesign: TForm;
  Memo1: TMemo;
  Button1, Button2, Button3: TButton;
  FindDialog1: TFindDialog;
  ReplaceDialog1: TReplaceDialog;

procedure OnFindDialog(Sender: TObject);
var
  i: Integer;
begin
        for i:=1 to SizeOf(Memo1.Lines) do
                if(Pos(FindDialog1.FindText, Memo1.Lines)<>0) then
                begin
                        Memo1.SelStart:=Pos(FindDialog1.FindText, Memo1.Lines);
                        Memo1.SelLength:=Length(FindDialog1.FindText);
                        Memo1.SetFocus;
                        Break;
                end;
end;

procedure FindClick(Sender: TObject);

begin
  FindDialog1.Execute;
end;

procedure FormInitialize;
begin
        frmDesign := CreateForm;
        frmDesign.Left := 250;
        frmDesign.Top := 114;
        frmDesign.Width := 313;
        frmDesign.Height := 480;
        frmDesign.Caption := 'Find and Replace Example';
        frmDesign.Color := clBtnFace;
        frmDesign.Font.Color := clWindowText;
        frmDesign.Font.Height := -11;
        frmDesign.Font.Name := 'MS Sans Serif';
        frmDesign.Font.Style := [];
        frmDesign.Visible := False;
        frmDesign.PixelsPerInch := 96;
        Memo1 := TMemo.Create(frmDesign);
        Memo1.Parent := frmDesign;
        Memo1.Left := 8;
        Memo1.Top := 40;
        Memo1.Width := 289;
        Memo1.Height := 401;
        Memo1.Lines.Add('Enter your text in this memo and either press the "Find" ');
        Memo1.Lines.Add('button or the "Replace" button to find and/or replace text ');
        Memo1.Lines.Add('from this memo.');
        Memo1.TabOrder := 8;
        Button1 := TButton.Create(frmDesign);
        Button1.Parent := frmDesign;
        Button1.Left := 8;
        Button1.Top := 8;
        Button1.Width := 75;
        Button1.Height := 25;
        Button1.Caption := 'Find';
        Button1.TabOrder := 9;
        Button1.OnClick := @FindClick;
        Button2 := TButton.Create(frmDesign);
        Button2.Parent := frmDesign;
        Button2.Left := 224;
        Button2.Top := 8;
        Button2.Width := 75;
        Button2.Height := 25;
        Button2.Caption := 'Replace';
        Button2.TabOrder := 10;
        Button3 := TButton.Create(frmDesign);
        Button3.Parent := frmDesign;
        Button3.Left := 120;
        Button3.Top := 8;
        Button3.Width := 65;
        Button3.Height := 25;
        Button3.Caption := 'Clear';
        Button3.TabOrder := 11;
        FindDialog1 := TFindDialog.Create(frmDesign);
        FindDialog1.Left := 32;
        FindDialog1.Top := 424;
        FindDialog1.OnFind := @OnFindDialog;
        ReplaceDialog1 := TReplaceDialog.Create(frmDesign);
        ReplaceDialog1.Top := 424;
end;

procedure ShowFormModal;
begin
  frmDesign.ShowModal;
end;

var
  TVA: TVariantArray;

begin
  ThreadSafeCall('FormInitialize', TVA);
  ThreadSafeCall('ShowFormModal', TVA);
end.[/scar]

BTW, SCARs CTRL+SHIFT+I formatting is shit (like 4 spaces). I was using the portable version. And i think i screwed something up in the above code...

But yerr.... Nice tutorial by the way ;)
« Last Edit: March 19, 2009, 04:24:54 am by Dan's The Man »

Offline Dan Cardin

  • Magical Yams
  • Global Moderator
  • *****
  • Posts: 417
  • Rep: 0
  • I is am are you!
    • MSN Messenger - thelonelydingo33@hotmail.com
    • AOL Instant Messenger - YoYoPotatoTomato
    • View Profile
    • DanCardin
    • Email
Re: The Form Tutorial
« Reply #10 on: March 19, 2009, 03:47:53 am »
I'm also positive the dialogues also work.

You just don't know how to use them properly :D
well that obviously isnt helpful, if you know how to get them to work then a short example wouldnt be as patronizing

Offline Dan's The Man

  • Hero Member
  • *****
  • Posts: 566
  • Rep: 1
    • MSN Messenger - ip.drowner@gmail.com
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #11 on: March 19, 2009, 04:25:44 am »
I'm also positive the dialogues also work.

You just don't know how to use them properly :D
well that obviously isnt helpful, if you know how to get them to work then a short example wouldnt be as patronizing
Sorry, look above ^^. I just did it in like 5 minutes since i was busy before :p

The same thing goes with the replace dialog from the find dialog :)

Offline Dan Cardin

  • Magical Yams
  • Global Moderator
  • *****
  • Posts: 417
  • Rep: 0
  • I is am are you!
    • MSN Messenger - thelonelydingo33@hotmail.com
    • AOL Instant Messenger - YoYoPotatoTomato
    • View Profile
    • DanCardin
    • Email
Re: The Form Tutorial
« Reply #12 on: March 19, 2009, 12:02:10 pm »
yes, i guess, but in this case your dialog is only as good as your code.
In your code, Match case, match whole word only, up, down all wouldnt work. I am aware that at least there are variables for the options, afaik, but if It doesnt properly have those options, then i dont feel the need to write my own functions for them in a tutorial. (i might eventually, but i can see my code either being lacking, or slow, which i wouldnt want to teach to people.

Offline Dan's The Man

  • Hero Member
  • *****
  • Posts: 566
  • Rep: 1
    • MSN Messenger - ip.drowner@gmail.com
    • View Profile
    • Email
Re: The Form Tutorial
« Reply #13 on: March 20, 2009, 03:18:21 am »
yes, i guess, but in this case your dialog is only as good as your code.
In your code, Match case, match whole word only, up, down all wouldnt work. I am aware that at least there are variables for the options, afaik, but if It doesnt properly have those options, then i dont feel the need to write my own functions for them in a tutorial. (i might eventually, but i can see my code either being lacking, or slow, which i wouldnt want to teach to people.
Oh you can, you just need to add more code :D That component meets its' purpose, to be a dialog. You still have to have the code yourself.

Offline Stranger

  • Newbie
  • *
  • Posts: 12
  • Rep: 0
    • View Profile
Re: The Form Tutorial
« Reply #14 on: March 09, 2011, 07:24:40 am »
It looks much better and niftier and neater and whatnot in the wiki, but i thought i'd make it known here.

The Form Tutorial

Hi,
the link is broken  ???

Freddy1990.com

Re: The Form Tutorial
« Reply #14 on: March 09, 2011, 07:24:40 am »