Hello All,
I'm not a really experienced openEdge-programmer and I have a problem with a script and I think the solution must be really easy but I can't find it.... So I hope someone can help me with my problem. The problem is that I have to put in a pause-statement to show my messages in te message-area and after I disabled widgets I have te put in a pause statement to realy disable the buttons on my screen (sometimes some buttons remain sensitive). I put a small test-script below to illustrate the 'pause-problems'. In my real program I run trough a large number of records and after each record I want to disable the buttons and show a message that something is being processed. You can imagine that I don't want to wait 2 seconds for each record. In the long run this takes up too much time.
Does anyone know what I'll have to do to fix this without using the pause-statement?
Thanks!
/* A Small testcase to illustrate the 'pause-problems' */
/******************************************************/
/* VARIABLE & FRAME */
/******************************************************/
DEFINE VARIABLE wWin3 AS WIDGET-HANDLE NO-UNDO.
DEFINE VARIABLE cVar AS CHARACTER NO-UNDO FORMAT "X(2)".
DEFINE BUTTON btnTest1 LABEL "DISABLE" SIZE-PIXELS 100 BY 25.
DEFINE BUTTON btnTest2 LABEL "CLOSE" SIZE-PIXELS 100 BY 25.
DEFINE BUTTON btnTest3 LABEL "DUMMY1" SIZE-PIXELS 100 BY 25.
DEFINE BUTTON btnTest4 LABEL "DUMMY2" SIZE-PIXELS 100 BY 25.
DEFINE FRAME frmTest
cVar AT ROW 2 COL 4.0
btnTest1 AT ROW 2 COL 20.0
btnTest2 AT ROW 2 COL 40.0
btnTest3 AT ROW 2 COL 60.0
btnTest4 AT ROW 2 COL 80.0
WITH OVERLAY SIDE-LABELS NO-BOX SIZE-PIXELS 520 BY 100 AT ROW 1 COL 1 THREE-D.
/******************************************************/
/* TRIGGERS */
/******************************************************/
ON CHOOSE OF btnTest1 IN FRAME frmTest
DO:
DISABLE cVar
btnTest1
btnTest2
btnTest3
btnTest4 WITH FRAME frmTest.
/* Sometimes not all the buttons in the disable-statement above will disable. if I put a pause in here it works but that's not solution i'm looking for */
/* PAUSE 0.7 NO-MESSAGE. */
ETIME(YES).
REPEAT:
IF ETIME > 3000
THEN
LEAVE.
END.
ENABLE ALL WITH FRAME frmTest.
END.
ON CHOOSE OF btnTest2 IN FRAME frmTest
DO:
APPLY 'CLOSE' TO THIS-PROCEDURE.
END.
/******************************************************/
/* INITIALIZE */
/******************************************************/
CREATE WINDOW wWin3
ASSIGN MESSAGE-AREA = YES
STATUS-AREA = YES
THREE-D = YES
WIDTH-PIXELS = 520
HEIGHT-PIXELS = 100
BGCOLOR = 8
TITLE = "Test".
/******************************************************/
/* MAIN CODE */
/******************************************************/
CURRENT-WINDOW = wWin3.
VIEW wWin3.
DISPLAY cVar
btnTest1
btnTest2
btnTest3
btnTest4 WITH FRAME frmTest.
RUN ip_test.
ENABLE cVar
btnTest1
btnTest2
btnTest3
btnTest4 WITH FRAME frmTest.
WAIT-FOR 'CLOSE' OF THIS-PROCEDURE.
/******************************************************/
/* PROCEDURES */
/******************************************************/
PROCEDURE ip_test:
MESSAGE "WHY DOESN'T HE SHOW THIS MESSAGE?" IN WINDOW wWin3.
/* if I put a pause in here it works but that's not solution i'm looking for */
/* PAUSE 0.7 NO-MESSAGE. */
ETIME(YES).
REPEAT:
IF ETIME > 1000
THEN
LEAVE.
END.
HIDE MESSAGE NO-PAUSE.
END PROCEDURE.
Try PROCESS EVENTS. instead of the PAUSE Statement.
That should allow the screen to repaint as well.
Thanks for your answer! It works great instead of the pause-statement I put in after the message statement. So that problem is solved thanks to you!
The problem of the buttons that won't disable remain the same... In my test-program PROCESS EVENTS seems to also solve the 'BUTTON-problem'. But in my real program where I have 11 buttons on my screen, there a only 3 buttons that become insensitive, the rest is still sensitive.
I've also tried to set the sensitive-attribute to false and used the view-statement... It still doesn't work... So now I have
- assign btnXXXXX:SENSITIVE IN FRAME frmTest = FALSE (for each button).
- VIEW FRAME frmTest.
- PROCESS EVENTS.
- DISABLE btnXXXXXX WITH FRAME frmMP3Bestand. (for each button)
- VIEW FRAME frmTest.
- PROCESS EVENTS.
FYI: In my real program I have a procedure 'ip_reset' where I disable the buttons. I don't know if it's a problem that this is inside a internal procedure but I don't think that's a problem.
This only works if I put a pause statement behind this. (PAUSE 0.7 NO-MESSAGE). But that's something I want te replace. Do you have another solution for this problem?
Thanks!
Try placing the PROCESS EVENTS inside the REPEAT loop instead.