1

Topic: Handling of pushing of three buttons in a parallel flow

It was puzzled with implementation of the given method, and experience with flows generally is not present. (
I will try to describe a task essence verbally
- There is a form and the Main procedure which produces any calculations
- On the form except different fields, is available Three buttons: " to Replace ", " to Pass " and " the Output "
- At a given time the Main procedure needs to transfer certain values or to start up it on one of three directions, depending on a choice of the user from three buttons.
At once I will tell - for the certain reasons, application of Dialog boxes does not approach me!
Implementation algorithmically I see approximately so:
- In the Main procedure in to Osn.potoke we write an infinite loop with the analysis in three Flags-variables - for example Zamena , Propusk , Vihod : Boolean ;
- Before this infinite loop to launch Dop.potok with three processing procedures the clique on appropriate keys, in each of which Flags-variables will change;
- .. Receiving the necessary flags in an infinite loop, Osn.potok stops Dop.potok and continues performance of the Main procedure.
On mine - this algorithm can be implemented by means of flows!?
There can be who or already implemented it or there are similar variants of the code?!
P.S. Occasionally - I congratulate all  and Administration with coming 2018!!!

2

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

- in the Main procedure in _._ we write an infinite loop with the analysis in three
Flags-variables - for example *Zamena *, *Propusk *, *Vihod*: *Boolean *;
- Before this infinite loop to launch _._ with three processing procedures the clique
On appropriate keys, in each of which Flags-variables will change;

On the contrary. In all GUI and including buttons the exceptional main flow should be engaged.
The additional flow - does all long operation, submitting to commands from the core.

3

Re: Handling of pushing of three buttons in a parallel flow

Dimitry Sibiryakov wrote:

On the contrary. In all GUI and including buttons the exceptional main flow should be engaged.
The additional flow - does all long operation, submitting to commands from the core.

Also what hinders Three processing procedures of pushing of buttons to write in the separate unit, to launch in Dop.potoke, and in the Core - to twirl in a cycle the analysis of Flags?
I.e. how I described - it does not turn out to make?
I simply want to refuse a separate Dialog box in Osn.protsedure, and buttons to allocate on the form!

4

Re: Handling of pushing of three buttons in a parallel flow

I probably understood!
Creating Dop.potok it is necessary to launch in it any procedure, and in mine  - only three output agents of pushing of keys!?

5

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

and in the Core - to twirl in a cycle the analysis of Flags?

In the main flow and so the operation cycle of messages is continuously twisted. What for one more?

6

Re: Handling of pushing of three buttons in a parallel flow

YuRock wrote:

In the main flow and so the operation cycle of messages is continuously twisted. What for one more?

Cycle of the analysis of response of a choice of the User, cycle of inquiry of Flag variables...

7

Re: Handling of pushing of three buttons in a parallel flow

After all when the normal Dialog box - is caused from the moment of its Output to the screen and before pushing of buttons - too after all inside there is a cycle of inquiry of keys, as a matter of fact!?

8

Re: Handling of pushing of three buttons in a parallel flow

YuRock wrote:

What for one more?

YuRock , offer then the variant - a failure of Dialog.okon and transfer of buttons on the main form!

9

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

the Cycle of the analysis of response of a choice of the User

For this purpose there are events . As a matter of fact -  messages wm_command.

Bellic wrote:

a cycle of inquiry of Flag variables...

Here it also push in , and at change - throw the message to the core that it is necessary to change something in display.

10

Re: Handling of pushing of three buttons in a parallel flow

Any flow of consciousness.
Operation becomes in a separate flow.
work in the main window, in the output agent the necessary actions with "a working" flow become.
Problem in what?

11

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

After all when the normal Dialog box - is caused from the moment of its Output to the screen and before pushing of buttons - too after all inside there is a cycle of inquiry of keys, as a matter of fact!?

It only in VCL such  the technology is used for a modality.

12

Re: Handling of pushing of three buttons in a parallel flow

YuRock wrote:

Here it also push in , and at change - throw the message to the core that it is necessary to change something in display.

It cannot be made!
In the Main procedure the heap of files is opened, many cycles and variables are involved, procedure is still fulfilled, simply the choice of the user, and all at once is necessary!!! All dares a normal Dialog box!!!
But Dialogue does not approach me!!!
It is necessary that decision-making buttons would be on the form!

13

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

It cannot be made!
In the Main procedure the heap of files is opened, many cycles and variables are involved, procedure is still fulfilled, simply the choice of the user, and all at once is necessary!!!

on it also it is necessary to transfer all it in  a flow, time is a lot of operation.
And a choice of the user to make before the beginning of this operation. After all same delirium when the user should sit 10 minutes to wait, while the program asks to make it a choice.

14

Re: Handling of pushing of three buttons in a parallel flow

YuRock wrote:

it is passed...
On it also it is necessary to transfer all it in  a flow, time is a lot of operation.
And a choice of the user to make before the beginning of this operation. After all same delirium when the user should sit 10 minutes to wait, while the program asks to make it a choice.

The user will not wait!
Even on the contrary - it should estimate quickly the intermediate results in Editah and other fields, and to push the necessary button!
On it I want and to refuse the Dialog box for it closes itself a part ., move it aside in manual - to waste time! Program to allocate for example in a screen corner - too not a variant - an abstraction of attention of the user, etc.

15

Re: Handling of pushing of three buttons in a parallel flow

Bellic wrote:

the User will not wait!

it is not clear then, what for other flow.

16

Re: Handling of pushing of three buttons in a parallel flow

YuRock;
Do not convince him, it is useless. The client should ripen.

17

Re: Handling of pushing of three buttons in a parallel flow

Guys, it is visible me someone will be strong to abuse now?!.))
But all code went in in the Main unit and without discovery of additional flows:
[spoiler Test code (sticks strongly not to beat!.)))]

unit Main_Module;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms;
Dialogs, ComCtrls, StdCtrls;
type
TMainForm = class (TForm)
SButton: TButton;
Button1: TButton;
Button2: TButton;
Button3: TButton;
MLabel: TLabel;
MMemo: TMemo;
procedure SButtonClick (Sender: TObject);
procedure Button1Click (Sender: TObject);
procedure Button2Click (Sender: TObject);
procedure Button3Click (Sender: TObject);
private
{Private declarations}
Flag1, Flag2, Flag3: Boolean;
public
{Public declarations}
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
//------------------------------------------------------------------------------
procedure TMainForm. Button1Click (Sender: TObject);//Button "Continue" of an abacus
begin
Flag1: = True;
end;
//------------------------------------------------------------------------------
procedure TMainForm. Button2Click (Sender: TObject);//Button "Pass" of an abacus
begin
Flag2: = True;
end;
//------------------------------------------------------------------------------
procedure TMainForm. Button3Click (Sender: TObject);//Button "Stop" of an abacus
begin
Flag3: = True;
end;
//------------------------------------------------------------------------------
procedure TMainForm. SButtonClick (Sender: TObject);//Button "Launch" of an abacus
var
i: Integer;
label
Metka;
begin MMemo. Lines. Add (' the account is launched ');
while True do
begin
for i: = 0 to 10 do
begin
MLabel. Caption: = IntToStr (i);
Application. ProcessMessages;
Sleep (500);
if i=5 then
begin
MMemo. Lines. Add (' we Continue a cycle? Push one of Buttons! ');
==> Metka: Application. ProcessMessages;//==============
==> if Flag1=True then begin
==> MMemo. Lines. Add (' it is pushed . To "Continue" ');
==> Flag1: = False;
==> Continue;
==> end;
==> if Flag2=True then begin
==> MMemo. Lines. Add (' it is pushed . To "Pass" ');
==> Flag2: = False;
==> Break;
==> end;
==> if Flag3=True then begin
==> MMemo. Lines. Add (' it is pushed . To "Stop" ');
==> Flag3: = False;
==> MMemo. Lines. Add (' the account Is stopped! ');
==> Exit;
==> end;
==> goto Metka;//==============================
end;
end;
end;
end;
//------------------------------------------------------------------------------
end.

[/spoiler] Can shoot me, but It perfectly works!.)))
Probably there will be remarks and to Test code, to cycles or to "GOTO" - to transition, but the essence here is important - while procedure "is twisted" in a cycle between the Label (it is selected by yellow color), analyzing three flags, the user making of the decision can push one of 3 buttons.
P.S. Searches on the Internet showed other variant - with analysis WM_LBUTTONDOWN, or WM_COMMAND, and then reading and the analysis of Hendla of the button... But at me while and it did not turn out to implement it.
In this case on mine it was possible to do without generally separate procedures - output agents of pushing of buttons!?

18

Re: Handling of pushing of three buttons in a parallel flow

wrote:

Why the hell flows and infinite loops????
It was possible for all objects to assign  one, or a call  .
And already there to create all affairs.

The additional flow in the extreme code - as you can see is not present!
And an infinite loop (that that is selected by color) - in expectation of change of flags...
Is better write really operating variant with "to one ".))

19

Re: Handling of pushing of three buttons in a parallel flow

Bellic;
Generally, judging by Sleep (500) - performance something durable there is planned, therefore almost all that in procedure ".SButtonClick ()" needs to be carried out in a separate flow and already from it to analyze a state of these flags.
And generally, infinite loops, moreover and with Sleep () in  a flow - it is not necessary so, users for  the interface will love you very long... Often to recall... A small bend... Well and so on.

20

Re: Handling of pushing of three buttons in a parallel flow

alekcvp wrote:

Generally, judging by Sleep (500) - performance something durable

Sleep (500) there is planned is a time delay, is pure in test code that the account was not such fast!.)))
[quote =] therefore almost all that in procedure ".SButtonClick ()" needs to be carried out in a separate flow and already from it to analyze a state of these flags.

What for still a flow? And so after all all works?
[quote =] And generally, infinite loops, moreover and with Sleep () in  a flow - it is not necessary so, users for  the interface will love you very long... Often to recall... A small bend... Well and so on.

the Test program - does not hang up, and Users - I am exceptional only, well can with friends I will share!.))