Board index » delphi » Please help a well meaning but fumbling beginner

Please help a well meaning but fumbling beginner

Hello

I recently finished a course in Delphi programming, it was a City and
guilds Level 1 type thing. I can do basic operations with forms etc but
I was hoping someone can put me on the correct path with an application
I hope to write which will produce a report containing interview prompts
depending on which areas the user selects.

Basically, from the users point of view, what they do is select one or
more topics from a set of radio buttons on a form e.g. Sensitivity. So
far so good, I can code that.

Then the hit a 'Print Report' button which produce the report for them
based on the topics they select, so for instance if they select six
areas using the radio buttons then the report will contain interview
questions based on those six areas, one after the other.

I have done something similar using MS Access, where I put the interview
questions in a table, then based a query on the table and produced a
report based on the query. What I want to do is have the whole thing as
a standalone application.

I would really appreciate it if someone could just paint the big picture
for me about what the main elements of something like this would be e.g.
does this information have to be in a table, could the table be accessed
by the user who could read its contents (which I don't want, could it
all be combined into one .exe file, or would I need to used a .dll file
as well (about which I know little).

If someone could give me an idea about how they might go about something
like this it would be really helpful.

Thank you very much.

Liam Healy

 

Re:Please help a well meaning but fumbling beginner


Hi Liam

Quote
L. Healy wrote in message <17HOIXAbQVz2E...@occpsy.demon.co.uk>...

[snip]

Quote
>I have done something similar using MS Access, where I put the interview
>questions in a table, then based a query on the table and produced a
>report based on the query. What I want to do is have the whole thing as
>a standalone application.

How to create an application like this depends lot of how much you want to
be able to change questions afterwards. With a bit more work on design time
you can create application witch can be usefull for a long time if your able
to alter/add questions or areas. That would be easier if you use tables or
ini -files to do this, but this would need use of Access or other DBs. If
needing to secure the questions I would use tables and also store all other
information  (radiobuttongroups would be created on runtime accroding to
stored information)

Quote
>I would really appreciate it if someone could just paint the big picture
>for me about what the main elements of something like this would be e.g.
>does this information have to be in a table, could the table be accessed
>by the user who could read its contents (which I don't want, could it
>all be combined into one .exe file, or would I need to used a .dll file
>as well (about which I know little).

Basicly this kind of app can be done in one exe -file, but it would reduce
it's modularity (altering of quostions). You won't be needing any dll's that
I can be sure off, but using somekind of datafiles would be needed.
Protecting data from users can be done with setting passwords to tables(most
databases support this) or by crypting datafiles.

Quote
>If someone could give me an idea about how they might go about something
>like this it would be really helpful.

Above are couple of things that you should consider, but here is summary of
what could be the way that I would do it

1) Create project to one single exe -file
    -all questions would be in predefined strings like
      question1 := 'This is the question if user selected topic 1' and so on
    -Use case and if to determine what to print in the report.

2) Create project with table.
    -would need BDE on client computer(I've heard of  some components that
would allow direct access to some of databases without BDE, but haven't seen
or tested them)
   -questions would be strored in password protected table and could be
altered afterward
  - Questions can be accessed with SQL SELECT statements

3) Create one exe and crypted datafile
    - Runs without any other app's needed
    - Questions can be altered afterward by sending new datafile
    - This would need somekind of crypting algorythm (I use DES wich I found
somewhere, but can mail it to you if needed)
    - Data can be accessed with basic file reading and would be secure (DES
is used in finnish bank transfers)

I would personlly use either 2 or 3 propable 3 if it needs to be standalone.

Quote
>Thank you very much.

I hope this gives you some ideas about what to start with, but if needing
further information don't hesitate to ask.
Sorry about poor english.

Mikko Isola

Re:Please help a well meaning but fumbling beginner


I have two Checkboxes (I have abandoned using radio buttons due to
problems with putting more than one on a panel - they act like a radio
group which is not what I want)

plus a memo box and a button, all on a single form.

When you check a memo box (or both of them) and hit the button I want
some text to be displayed in the memo box, this is the code I have
written so far:

-----------------------------------

var
  Form1: TForm1;
  const
  Q1:String = 'test1';
  Q2:String = 'test2';

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin

If Checkbox1.Checked = true then

Memo1.Text := Q1;

If Checkbox2.Checked = true then

Memo1.Text := Q2;

end;

end.

---------------------

the problem is that the when the text appears in the memo it replaces
what is there, so even if you check both boxes the memo will only
display the text associated with the last one. What I want it to do is
to add the text to what is already there, so if both checkboxes are
checked then both strings are shown.

I have tried to get the 'Add' procedure to work, but this depends on
indexes , and the 'Append' procedure but I cant get the code right.

In intuitive English (but very poor Pascal, I accept), this is what I
would write

---------------------------------

procedure TForm1.Button1Click(Sender: TObject);
begin

If Checkbox1.Checked = true then

Memo1.Text.Append {or 'Add' or whatever}:= Q1;

If Checkbox2.Checked = true then

Memo1.Text.Append := Q2; {so it doesn't replace what has put there by
Checkbox1, rather it adds to it}

end;

end.

---------------------------------

so it would put them both in.

Any ideas, thanks to all the people who have helped so far. I'm taking
my first steps.

Thanks

Liam Healy

Re:Please help a well meaning but fumbling beginner


Hi!

Simply add new text to existing one:
Memo1.Text := Memo1.Text + 'Your added text";

Beno

Quote
L. Healy wrote in message <2b8OwJApUV02E...@occpsy.demon.co.uk>...

>I have two Checkboxes (I have abandoned using radio buttons due to
>problems with putting more than one on a panel - they act like a radio
>group which is not what I want)

>plus a memo box and a button, all on a single form.

>When you check a memo box (or both of them) and hit the button I want
>some text to be displayed in the memo box, this is the code I have
>written so far:

>-----------------------------------

>var
>  Form1: TForm1;
>  const
>  Q1:String = 'test1';
>  Q2:String = 'test2';

>implementation

>{$R *.DFM}

>procedure TForm1.Button1Click(Sender: TObject);
>begin

>If Checkbox1.Checked = true then

>Memo1.Text := Q1;

>If Checkbox2.Checked = true then

>Memo1.Text := Q2;

>end;

>end.

>---------------------

>the problem is that the when the text appears in the memo it replaces
>what is there, so even if you check both boxes the memo will only
>display the text associated with the last one. What I want it to do is
>to add the text to what is already there, so if both checkboxes are
>checked then both strings are shown.

>I have tried to get the 'Add' procedure to work, but this depends on
>indexes , and the 'Append' procedure but I cant get the code right.

>In intuitive English (but very poor Pascal, I accept), this is what I
>would write

>---------------------------------

>procedure TForm1.Button1Click(Sender: TObject);
>begin

>If Checkbox1.Checked = true then

>Memo1.Text.Append {or 'Add' or whatever}:= Q1;

>If Checkbox2.Checked = true then

>Memo1.Text.Append := Q2; {so it doesn't replace what has put there by
>Checkbox1, rather it adds to it}

>end;

>end.

>---------------------------------

>so it would put them both in.

>Any ideas, thanks to all the people who have helped so far. I'm taking
>my first steps.

>Thanks

>Liam Healy

Re:Please help a well meaning but fumbling beginner


Hi

Quote
L. Healy wrote in message <2b8OwJApUV02E...@occpsy.demon.co.uk>...

[Snip]

Quote
>In intuitive English (but very poor Pascal, I accept), this is what I
>would write
>---------------------------------
>procedure TForm1.Button1Click(Sender: TObject);
>begin

Memo1.Clear; // Clear previous data from memo1

Quote
>If Checkbox1.Checked = true then
>Memo1.Text.Append {or 'Add' or whatever}:= Q1;

Memo1.Lines.Add(Q1); // Adds Q1 to last line of memo1

Quote
>If Checkbox2.Checked = true then
>Memo1.Text.Append := Q2; {so it doesn't replace what has put there by

Memo1.Lines.Add(Q2); Adds Q2 to last line of memo1 (keeps Q1 if it's been
inserted)

Quote
>Checkbox1, rather it adds to it}
>end;
>end.
>---------------------------------
>so it would put them both in.

You can access/add/delete individual lines from Memo by it's lines property.
Memo1.Clear that I added will clear all text in memo, so if user clicks
button second time, memo woun't contain previous selections

Hopefully these get you forward with your project.

Good luck,
Mikko Isola

Other Threads