 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Jean-Michel Guest
|
Posted: Fri Oct 24, 2003 10:14 am Post subject: Variable Help |
|
|
Greetings All,
I'm not quite sure how to put this, what i'm trying to do is use a variable
with an adjusting number. The variable is "Day", now the thing is, i need to
test for three days and have corresponding variables, day1, day2, day3. But
i want the number's added from a counter. So... i want to know if there is
an operator that can change with the counter and adjust the variable?
code i have so far:
for count1 := 1 to 3 do
begin
inputquery('How many hours Available on Day
'+inttostr(count1),'Hours',temp2);
if strtoint(temp2) > 3
then inc(day$);
{ ^ Operator which i want to sync
with the counter}
end;
And 1 other thing, I'm running various tests from the formcreate procedure.
But i have to break to go to another procedure, now. Is there a way to
continue the code within the formcreate procedure without recreating the
form?
Thanks A lot.
J-M
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Fri Oct 24, 2003 2:17 pm Post subject: Re: Variable Help |
|
|
I am not sure I understand what you are trying to do. My best guess is
the following.
var
day: array[1..3] of integer;
begin
for count1 := 1 to 3 do
begin
inputquery('How many hours Available on Day
'+inttostr(count1),'Hours',temp2);
if strtoint(temp2) > 3
then inc(day[count1]);
{ ^ Operator which i want to
sync
with the counter}
end;
Just call the other procedure from your FormCreate event handler and
control will return to the ForCreate event handler when the other
procedure finishes executing.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Mon Oct 27, 2003 11:01 am Post subject: Re: Variable Help |
|
|
Hey,
Thanks for all your help so far.
But, I'm not quite sure what you mean by the second part.
How do i call the procedure in the FormCreate procedure?
If you could maybe give me an example?
Thanks A lot.
J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: | I am not sure I understand what you are trying to do. My best guess is
the following.
var
day: array[1..3] of integer;
begin
for count1 := 1 to 3 do
begin
inputquery('How many hours Available on Day
'+inttostr(count1),'Hours',temp2);
if strtoint(temp2) > 3
then inc(day[count1]);
{ ^ Operator which i want to
sync
with the counter}
end;
Just call the other procedure from your FormCreate event handler and
control will return to the ForCreate event handler when the other
procedure finishes executing.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Mon Oct 27, 2003 7:09 pm Post subject: Re: Variable Help |
|
|
On Mon, 27 Oct 2003 13:01:53 +0200, "Jean-Michel"
<aajlouw (AT) absamail (DOT) co.za> wrote:
| Quote: | How do i call the procedure in the FormCreate procedure?
If you could maybe give me an example?
|
begin
MyOtherProcedure(AParameter);
A := B + C
end;
In the code above the call to the procedure named MyOtherProcedure
will cause MyOtherProcedure to execute then execution will continue
with A := B + C.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Tue Oct 28, 2003 8:55 pm Post subject: Re: Variable Help |
|
|
Hey Bill,
That doesn't quite work. The thing is that the FormCreate procedure uses
loops to gather information, but it has to stop after each loop and wait for
a buttonclick procedure to be completed(in which i test whether some
checkboxs are selected and adjusted the respective vars). Then continue with
the loops in the FormCreate procedure.
Sorry to be difficult.
Thanks for the help.
J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: | On Mon, 27 Oct 2003 13:01:53 +0200, "Jean-Michel"
[email]aajlouw (AT) absamail (DOT) co.za[/email]> wrote:
How do i call the procedure in the FormCreate procedure?
If you could maybe give me an example? :-)
begin
MyOtherProcedure(AParameter);
A := B + C
end;
In the code above the call to the procedure named MyOtherProcedure
will cause MyOtherProcedure to execute then execution will continue
with A := B + C.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Tue Oct 28, 2003 9:38 pm Post subject: Re: Variable Help |
|
|
On Tue, 28 Oct 2003 22:55:21 +0200, "Jean-Michel"
<aajlouw (AT) absamail (DOT) co.za> wrote:
| Quote: | That doesn't quite work. The thing is that the FormCreate procedure uses
loops to gather information, but it has to stop after each loop and wait for
a buttonclick procedure to be completed(in which i test whether some
checkboxs are selected and adjusted the respective vars).
|
Sorry but I am totally confused. Why don't you just put the code in
the button's OnClick event handler so it runs each time the button is
clicked. I also do not know if the button is on the form whose
OnCreate event handler we are discussing or on another form. I need a
complete explanation of the process before I can tell you how to
structure the code.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Wed Oct 29, 2003 5:08 am Post subject: Re: Variable Help |
|
|
Okay Cool,
Well here goes.
From application runtime, a set of loops are initiated to gather various
pieces of information. All of whch is in the FormCreate procedure, then at
the end of each loop, it breaks and waits for the user to make a selection
from a group of checkboxs(on the form whose FormCreate procedure we are
discussing) and press the "continue" button. Thus repeating the loops and
breaking to await user input again. I hope this is slightly clearer.
Thanks A Lot
J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: | On Tue, 28 Oct 2003 22:55:21 +0200, "Jean-Michel"
[email]aajlouw (AT) absamail (DOT) co.za[/email]> wrote:
That doesn't quite work. The thing is that the FormCreate procedure uses
loops to gather information, but it has to stop after each loop and wait
for
a buttonclick procedure to be completed(in which i test whether some
checkboxs are selected and adjusted the respective vars).
Sorry but I am totally confused. Why don't you just put the code in
the button's OnClick event handler so it runs each time the button is
clicked. I also do not know if the button is on the form whose
OnCreate event handler we are discussing or on another form. I need a
complete explanation of the process before I can tell you how to
structure the code.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Wed Oct 29, 2003 1:54 pm Post subject: Re: Variable Help |
|
|
I would do that using two forms. On Form1 the user would click a
button or make a menu selection to start the loops. At the end of each
loop I would show a second modal form where the user could set the
checkboxes and click OK to continue.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Wed Oct 29, 2003 3:44 pm Post subject: Re: Variable Help |
|
|
Okay,
Thanks very much. But for reference purposes is there in which my idea could
work?
Thanks Again
J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: | I would do that using two forms. On Form1 the user would click a
button or make a menu selection to start the loops. At the end of each
loop I would show a second modal form where the user could set the
checkboxes and click OK to continue.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Wed Oct 29, 2003 4:15 pm Post subject: Re: Variable Help |
|
|
On Wed, 29 Oct 2003 17:44:51 +0200, "Jean-Michel"
<aajlouw (AT) absamail (DOT) co.za> wrote:
| Quote: | But for reference purposes is there in which my idea could
work?
|
No, not as I understand what you are doing. Using your approach there
is no way for the user to know when the loop has ended and no way to
pause execution of the loop while the user interacts with the form.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Wed Oct 29, 2003 10:24 pm Post subject: Re: Variable Help |
|
|
Oh, sorry.
I misphrased that. the loops are also for user inputed info.(using
inputqueries). i was using break to pause and go to the second set. But i
don't have a way of returning to the loops.
Well no matter, if you can think of anything, I appreciate it. Otherwise,
don't worry about it. Enjoy your weekend.
Ciao J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: |
On Wed, 29 Oct 2003 17:44:51 +0200, "Jean-Michel"
[email]aajlouw (AT) absamail (DOT) co.za[/email]> wrote:
But for reference purposes is there in which my idea could
work?
No, not as I understand what you are doing. Using your approach there
is no way for the user to know when the loop has ended and no way to
pause execution of the loop while the user interacts with the form.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Wed Oct 29, 2003 10:54 pm Post subject: Re: Variable Help |
|
|
On Thu, 30 Oct 2003 00:24:43 +0200, "Jean-Michel"
<aajlouw (AT) absamail (DOT) co.za> wrote:
| Quote: | i was using break to pause and go to the second set. But i
don't have a way of returning to the loops.
|
The Break command does not pause anything. It just jumps out of the
current loop and continues execution with the first statement after
the loop.
InputQuery shows a modal dialog box so it is just another way of
implementing my suggestion.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Wed Oct 29, 2003 11:09 pm Post subject: Re: Variable Help |
|
|
Sorry another mis phrasing of words, but i think you get what i'm trying to
say. I break the loops which gather specific information from the user, to
go to a group of checkboxs' whcih the user must choose at least one of.
Then, here's my problem i want to re-initiate the loops in the FormCreate
procedure. Of which so far, you have said is not possible.
Hope that's clear enough and that you have any ideas'
Thanks
J-M
| Quote: | The Break command does not pause anything. It just jumps out of the
current loop and continues execution with the first statement after
the loop.
InputQuery shows a modal dialog box so it is just another way of
implementing my suggestion.
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
Bill Todd Guest
|
Posted: Thu Oct 30, 2003 12:03 am Post subject: Re: Variable Help |
|
|
If you want to do something in response to a user's action then you
should put the code in the event handler for an event that is
triggered by whatever the user does.
To answer your question, no, I do not understand what you are doing.
My best guess now is that you need to run some process when the form
opens then run it again after the user does something in the form. If
that is the case then put the code with the loops in a custom method.
Call the custom method from the OnCreate event handler. Call the
custom method again when the user clicks a button on the form.
Does that make sense?
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
| Back to top |
|
 |
Jean-Michel Guest
|
Posted: Thu Oct 30, 2003 9:14 am Post subject: Re: Variable Help |
|
|
Yeah,
I was just thinking about somehing along those lines. Not quite what i
wanted, but i suppose even in the creation of things there are limitations.
Thanks for all your help.
Catch ya later
J-M
"Bill Todd" <no (AT) no (DOT) com> wrote
| Quote: | If you want to do something in response to a user's action then you
should put the code in the event handler for an event that is
triggered by whatever the user does.
To answer your question, no, I do not understand what you are doing.
My best guess now is that you need to run some process when the form
opens then run it again after the user does something in the form. If
that is the case then put the code with the loops in a custom method.
Call the custom method from the OnCreate event handler. Call the
custom method again when the user clicks a button on the form.
Does that make sense?
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
|
|
|
| Back to top |
|
 |
|
|
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
|
|