Exit of the cycle DO WHILE on button pressing in a cycle

This forum is for eXpress++ general support.
Message
Author
Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Exit of the cycle DO WHILE on button pressing in a cycle

#11 Post by Cliff Wiernik »

Okay. I though use the format alot as I like it better for alot of case. wtf also is very good with alot of different valuable enhancement.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Exit of the cycle DO WHILE on button pressing in a cycle

#12 Post by Eugene Lutsenko »

All I thank!!!

If to take your example as a basis, whether that it is impossible to modify it as follows. You to these very much would help me. I tried to make itself, but at me it did not turn out yet.

-----------------------------------------------------------
At program start at once to begin process, which IN a cycle.

Let, for example, this process consists in summation 1 to some variable and a conclusion of its value to the screen. The initial value of a variable which is set to a cycle, is equal to zero.

This process should be executed ONCE and stop.

Here the user should have possibility to choose by means of buttons or process repetition, or an exit from a cycle.

If the user chooses repetition, the user should have possibility to set in dialogue other initial value of a variable. Then everything repeats since the beginning, but already with this new initial value of a variable.

If the user chooses an exit - there is an end of the program and a conclusion to the screen of final value of a variable.
-----------------------------------------------------------

Code: Select all

/*
Exit from the cycle DO WHILE on a button anzhatiya in a cycle
*/
PROCEDURE AppSys
RETURN

FUNCTION Main()

LOCAL GetList[0], lProcessing := .T., oStatus, nCount := 1

DO WHILE .T.

   @ 0,0 DCSAY "Current value of a variable="+ALLTRIM(STR(nCount++,15))

   @ 1,0 DCSAY "Set new value of a variable: " GET nCount PICTURE "######"


   @ 3,0 DCPUSHBUTTON CAPTION 'Start Process' SIZE 20,1.5 ;
         ACTION {||lProcessing := .T.}

   @ 5,0 DCPUSHBUTTON CAPTION 'End Process'   SIZE 20,1.5 ;
         ACTION {||lProcessing := .F.}


   DCREAD GUI FIT TITLE 'Processing Test'

   IF lProcessing = .F.
      EXIT
   ENDIF

ENDDO

MsgBox("Final value of a variable="+ALLTRIM(STR(nCount,15)))

RETURN nil
Something like it... But it doesn't work as it is necessary:
1. Buttons don't react at all.
2. After an exit from a cycle value of a variable should be displayed in the same window.
3. When you press on red [X] at the upper right, полчается something, how on a clique on the button [Start Process].
4. The exit from a cycle occurs not after a click on the button [End Process], and after it pressing on red [X] at the upper right.

PS Once again I want to express to you gratitude and gratitude for the rendered invaluable help. If it is honest, I haven't enough time since I conduct occupations at two universities water on 1.5, and in other on 0.5 rates, and still I still have a scientific magazine. Therefore, unfortunately, I can't give to development so much time, how many I would like. But when I am engaged in development I have a rest soul and I create a reserve for the future and prospect for teaching and scientific work.

Somebody can still will help from those who treats favourably my efforts and more than once responded on my requests

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: Exit of the cycle DO WHILE on button pressing in a cycle

#13 Post by Koverhage »

Hi,

you should use this

@ 3,0 DCPUSHBUTTON CAPTION 'Start Process' SIZE 20,1.5 ;
ACTION {||lProcessing := .T., DC_ReadGuiEvent( DCGUI_EXIT_OK, GetList ) }
Klaus

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Exit of the cycle DO WHILE on button pressing in a cycle

#14 Post by Eugene Lutsenko »

Now works perfectly, that is necessary! Many thanks to all!

Code: Select all

PROCEDURE AppSys
RETURN

FUNCTION Main()

LOCAL GetList[0], lProcessing := .T., oStatus, nCount := 1

DO WHILE .T.

   @ 0,0 DCSAY "Current value of a variable="+ALLTRIM(STR(nCount++,15))

   @ 1,0 DCSAY "Set new value of a variable: " GET nCount PICTURE "######"


   @ 3,0 DCPUSHBUTTON CAPTION 'Start Process' SIZE 20,1.5 ;
         ACTION {||lProcessing := .T., DC_ReadGuiEvent( DCGUI_EXIT_OK, GetList ) }

   @ 5,0 DCPUSHBUTTON CAPTION 'End Process' SIZE 20,1.5 ;
         ACTION {||lProcessing := .F., DC_ReadGuiEvent( DCGUI_EXIT_OK, GetList ) }


   DCREAD GUI FIT TITLE 'Processing Test'

   IF lProcessing = .F.
      EXIT
   ENDIF

ENDDO

MsgBox("Final value of a variable="+ALLTRIM(STR(nCount,15)))

RETURN nil

Post Reply