proper use of a loop & DCSAYGETs

This forum is for eXpress++ general support.
Message
Author
Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

Re: proper use of a loop & DCSAYGETs

#11 Post by Maxz »

since apparently it seems unsolvable my problem,
tell me the correct way to insert the construction of the GET inside a my custom loop and make sure that at the end of DCREAD I can clean the memory and recreate the GET again?

for example:
DO WHILE .T.
GetList := {}
GetOptions:=NIL
lExit:=.F.

// recreate all GETs
@ ... DCGET a
@ ... DCGET b
@ ... DCGET c

DCGETOPTIONS ....

DCREAD GUI ....

IF lExit
EXIT
ENDIF

DC_GetDestroy(GetList)
ENDDO


thank you for the help you can give me. I would not want my program to fill its memory with unnecessary instructions and variables during operation

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: proper use of a loop & DCSAYGETs

#12 Post by skiman »

Hi,

I have no idea whhat you want to accomplish? The default behaviour does what you want in my opinion?

You mention 'custom loop', maybe you can create your own 'handler', that way you can 'change' the default behaviour if you want something specific.
Best regards,

Chris.
www.aboservice.be

User avatar
Tom
Posts: 1173
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: proper use of a loop & DCSAYGETs

#13 Post by Tom »

DCREAD GUI is the loop.

If you want to create a dialog to access, modify and insert data, you don't need to put a loop around it and create it again and again. Take a look at all the clauses DCSAYGETs have, like WHEN or EDITPROTECT or HIDE. Look at codeblocks as button captions. Look at DC_GetRefresh(GetList). Look at all the samples coming with eXpress++. Once you created a flexible dialog, everything can be done in one event loop, and this is DCREAD GUI. Put new data in the GETs, change button captions and behaviour, whatever you want.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: proper use of a loop & DCSAYGETs

#14 Post by skiman »

Hi Tom,

Thanks for the post. I started to doubt whether I was really the only one who didn't understand the problem. :-)

So now we can go back to post 3 in this thread...
Best regards,

Chris.
www.aboservice.be

Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

Re: proper use of a loop & DCSAYGETs

#15 Post by Maxz »

however, a point does not seem to work without an external loop:

"ENTER on last Get confirm all data, (same as Confirm button)" - using ENTEREXIT clause on DCREAD GUI

if the user navigates between the GETS and arrives at the bottom of the GETs, the program must ask whether or not we want to record the information exactly as if he press CONFIRM button
saying yes or no, the program must always remain inside the DCREAD loop (like pushbuttons CONFIRM, CANCEL)

"ENTEREXIT will exit the dialog if the ENTER key is pressed. The
exact behavior is determined by the DC_EnterExitMode() function.
The default behavior is to exit the dialog when the ENTER keys is
pressed in the "last GET"
. If this option is not used, then pressing
the ENTER key in the last GET will cause the first GET to receive
focus provided that SET WRAP is ON, otherwise pressing ENTER in the
last GET will have no affect."


this in my opinion it is not possible to simulate it inside the loop of the DCREAD if not going to intercept the last GET and create a trick to make sure to ask if you want to store or not all the data

Right?
I thank you for the patience you have with me to answer questions that for you could be simple but for me they are essential :clap:

skiman
Posts: 1185
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: proper use of a loop & DCSAYGETs

#16 Post by skiman »

Hi,

You could use a keyblock in the last get.
KEYBLOCK <bKeyBlock> is a code block to evaluate when a key is
pressed in the GET. The code block should be formatted as follows:
{|mp1,xNil,oXbp|MyFunc(mp1,xNil,oXbp)} where <mp1> is the
numeric value (defined in APPEVENT.CH) of the key pressed and
oXbp is the GET object.

In Myfunc you can check if mp1 is the ENTER key, so you can show a popup to proceed as you want.
Best regards,

Chris.
www.aboservice.be

Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

Re: proper use of a loop & DCSAYGETs

#17 Post by Maxz »

might be a good idea. I try to implement it. Thank you

User avatar
Tom
Posts: 1173
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: proper use of a loop & DCSAYGETs

#18 Post by Tom »

Using the LOSTFOCUS clause (maybe in addition) at the last get should do the same job. Besides, (not only) if ENTEREXIT is used, CLOSEQUERY and ABORTQUERY (DCGET OPTIONS) allow to catch the quitting of a dialog, ask a question maybe and return to the dialog if needed. This not only works with ENTEREXIT, it also works with the X-button and other buttons added to close the dialog.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply