proper use of a loop & DCSAYGETs
proper use of a loop & DCSAYGETs
to be able to create a continuous get loop that stops only with an exit button, do I have to use the SAVE clause in a DCREAD statement?
---------------------------------------------------------
LOCAL GetOptions ,GetList := {}
lExitKey:=.F.
a:=b:=c:=d:=SPACE(10)
@ 1,0 DCGET a GETOBJECT 1st_get
@ 2,0 DCGET b
@ 3,0 DCGET c
@ 4,0 DCGET b
@ 10, 0 DCPUSHBUTTON CAPTION "SAVE" ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList) } SIZE 12,1
@ 10,20 DCPUSHBUTTON CAPTION "EXIT" ACCELKEY xbeK_ESC CARGO 'CANCEL' ACTION {|| lExitKey:=.T.,DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList) } SIZE 12,1
DCGETOPTIONS ......
DO WHILE .T.
DCREAD GUI TO lStatus OPTIONS GetOptions SAVE CLEAREVENTS EVAL {||DC_GETREFRESH(GetList)} SETFOCUS @1st_get
IF lExitKey
EXIT
ENDIF
MY_SAVE_FUNC()
a:=b:=c:=d:=SPACE(10)
ENDDO
DC_GETDESTROY(GetList,,.T.)
---------------------------------------------
the GetList always remains alive ?
---------------------------------------------------------
LOCAL GetOptions ,GetList := {}
lExitKey:=.F.
a:=b:=c:=d:=SPACE(10)
@ 1,0 DCGET a GETOBJECT 1st_get
@ 2,0 DCGET b
@ 3,0 DCGET c
@ 4,0 DCGET b
@ 10, 0 DCPUSHBUTTON CAPTION "SAVE" ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList) } SIZE 12,1
@ 10,20 DCPUSHBUTTON CAPTION "EXIT" ACCELKEY xbeK_ESC CARGO 'CANCEL' ACTION {|| lExitKey:=.T.,DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList) } SIZE 12,1
DCGETOPTIONS ......
DO WHILE .T.
DCREAD GUI TO lStatus OPTIONS GetOptions SAVE CLEAREVENTS EVAL {||DC_GETREFRESH(GetList)} SETFOCUS @1st_get
IF lExitKey
EXIT
ENDIF
MY_SAVE_FUNC()
a:=b:=c:=d:=SPACE(10)
ENDDO
DC_GETDESTROY(GetList,,.T.)
---------------------------------------------
the GetList always remains alive ?
Re: proper use of a loop & DCSAYGETs
Why do you want a loop?
The eXpress train is coming - and it has more cars.
Re: proper use of a loop & DCSAYGETs
Hi,
DCREAD GUI is doing this for you. This waits for events, there is no need to have a loop!
Has to be changed to:
This way you can remove your do while loop.
DCREAD GUI is doing this for you. This waits for events, there is no need to have a loop!
Code: Select all
@ 10, 0 DCPUSHBUTTON CAPTION "SAVE" ACTION {|| DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList) } SIZE 12,1
Code: Select all
@ 10, 0 DCPUSHBUTTON CAPTION "SAVE" ACTION {|| MY_SAVE_FUNC() , a:=b:=c:=d:=SPACE(10),setappfocus(1st_get),DC_GETREFRESH(GetList) } SIZE 12,1
Re: proper use of a loop & DCSAYGETs
it is not easy for me to explain the reason for the necessary double loop.
attached a small prg to test and what I try to make work:
The dcread loop is used to manage the actions of the main buttons (INS,DEL,MOD,VIEW & EXIT); other buttons (secondary) are dedicate to SAVE & CANCEL action (in editing mode)
The main loop is required to use the ENTEREXIT clause of DCREAD
- until I exit the internal loop of the DCREAD, the function keys F2, ESC, ENTER work well and also the buttons and actions
- when i use CONFIRM or CANCEL pushbutton, exiting to DCREAD loop, the function keys, actions and pushbutton EXIT are no longer functional
where am I wrong?
attached a small prg to test and what I try to make work:
The dcread loop is used to manage the actions of the main buttons (INS,DEL,MOD,VIEW & EXIT); other buttons (secondary) are dedicate to SAVE & CANCEL action (in editing mode)
The main loop is required to use the ENTEREXIT clause of DCREAD
- until I exit the internal loop of the DCREAD, the function keys F2, ESC, ENTER work well and also the buttons and actions
- when i use CONFIRM or CANCEL pushbutton, exiting to DCREAD loop, the function keys, actions and pushbutton EXIT are no longer functional
where am I wrong?
Re: proper use of a loop & DCSAYGETs
This is a very hard design to manage.
What kind of navigation are you trying to accomplish?
It appears that the only way you can navigate is with the mouse.
It doesn't accept enter or tab.
What kind of navigation are you trying to accomplish?
It appears that the only way you can navigate is with the mouse.
It doesn't accept enter or tab.
The eXpress train is coming - and it has more cars.
Re: proper use of a loop & DCSAYGETs
I know it looks a bit strange as I thought it ...
the behavior I am trying to achieve is to follow this rule:
if I put all the GET construction into the loop and don't use the SAVE clause in the DCREAD, the main loop system works properly. obviously this penalizes the speed of preparation of the screen in case of large amount of GET in the screen, unfortunately
that's why I wanted to keep the GetList and GetOptions active inside the main loop
max
the behavior I am trying to achieve is to follow this rule:
- the user starts by seeing the screen and the main buttons INS,MOD,DEL,VIEW, EXIT available
- by pressing exit, the program ends
- by pressing the other buttons, it enters input mode on the Gets - the main buttons disappear and the Confirm /Cancel buttons appear
- the user can use the keyboard by moving with Enter to the end of the screen, F2 to view the available choices (popup)
- ESC can be used to exit from input mode (same as Cancel button)
- ENTER on last Get confirm all data, (same as Confirm button)
- the screen returns to the input lock state and the secondary buttons disappear while the main buttons reappear and everything starts again
if I put all the GET construction into the loop and don't use the SAVE clause in the DCREAD, the main loop system works properly. obviously this penalizes the speed of preparation of the screen in case of large amount of GET in the screen, unfortunately
that's why I wanted to keep the GetList and GetOptions active inside the main loop
max
Re: proper use of a loop & DCSAYGETs
Hi,
I was wondering if you can't use a lEdit var to activate show/hide what you want?
All the GET's have when {|| lEdit }
In the action of the buttons: INS,MOD,DEL,VIEW you have lEdit:=.T., these buttons have a hide clause HIDE {|| lEdit }
Confirm /Cancel buttons have as action lEdit:=.F. and a hide clause HIDE {|| !lEdit }
This way you can trigger the EDIT mode when you want it. Maybe I'm missing something, but this seems a rather normal behaviour to me?
I was wondering if you can't use a lEdit var to activate show/hide what you want?
At start lEdit := .F.the user starts by seeing the screen and the main buttons INS,MOD,DEL,VIEW, EXIT available
by pressing exit, the program ends
by pressing the other buttons, it enters input mode on the Gets - the main buttons disappear and the Confirm /Cancel buttons appear
All the GET's have when {|| lEdit }
In the action of the buttons: INS,MOD,DEL,VIEW you have lEdit:=.T., these buttons have a hide clause HIDE {|| lEdit }
Confirm /Cancel buttons have as action lEdit:=.F. and a hide clause HIDE {|| !lEdit }
This way you can trigger the EDIT mode when you want it. Maybe I'm missing something, but this seems a rather normal behaviour to me?
Re: proper use of a loop & DCSAYGETs
the trigger system works well, that's not the problem
the most important problem is:
what I do not understand on the example I wrote is the fact that at the first input of the DCREAD loop everything works correctly but when I exit with the SAVE clause from the loop and re-enter the DCREAD, the ENTER, ESC keys and the buttons stop working
if I put all the GET construction into the loop and don't use the SAVE clause in the DCREAD, the main loop system works properly. obviously this penalizes the speed of preparation of the screen in case of large amount of GET in the screen, unfortunately
that's why I wanted to keep the GetList and GetOptions active inside the main loop
it's probably me who didn't understand what happens inside a DCREAD and what happens when you go out
the most important problem is:
what I do not understand on the example I wrote is the fact that at the first input of the DCREAD loop everything works correctly but when I exit with the SAVE clause from the loop and re-enter the DCREAD, the ENTER, ESC keys and the buttons stop working
if I put all the GET construction into the loop and don't use the SAVE clause in the DCREAD, the main loop system works properly. obviously this penalizes the speed of preparation of the screen in case of large amount of GET in the screen, unfortunately
that's why I wanted to keep the GetList and GetOptions active inside the main loop
it's probably me who didn't understand what happens inside a DCREAD and what happens when you go out
Re: proper use of a loop & DCSAYGETs
Roger,
when you have time, explain to me what happens when I leave the DCREAD loop with the SAVE clause ?
"SAVE will save the GetList array after returning from the text
or GUI reader. If the SAVE clause is not used, the GetList
array will be re-initialized to an empty array."
can I use the GetList again or not? otherwise I can't go on properly
when you have time, explain to me what happens when I leave the DCREAD loop with the SAVE clause ?
"SAVE will save the GetList array after returning from the text
or GUI reader. If the SAVE clause is not used, the GetList
array will be re-initialized to an empty array."
can I use the GetList again or not? otherwise I can't go on properly
Re: proper use of a loop & DCSAYGETs
Hi,
If you want to save a getlist to a file and get it back later to display the screen it won't work as far as I know. I tried this when I started with Express and it wasn't working. I thought it would be faster to re-display dialogs/screens.
With the save you can have a getlist, which you can add to the current getlist. Suppose you have a screen with 10 tabpages. When a user opens the screen, you show tabpage 1. When tabpage 2 is selected, you can create the getlist, save it, and add it to the existing with DC_MergeGetLists.
If you want to save a getlist to a file and get it back later to display the screen it won't work as far as I know. I tried this when I started with Express and it wasn't working. I thought it would be faster to re-display dialogs/screens.
With the save you can have a getlist, which you can add to the current getlist. Suppose you have a screen with 10 tabpages. When a user opens the screen, you show tabpage 1. When tabpage 2 is selected, you can create the getlist, save it, and add it to the existing with DC_MergeGetLists.