browse problem - please help

melmckee72

New Member
working in 9.1a chui environment

working with updateable browse and having trouble with 2 things.

first - if on leave trigger finds available record can not leave the browse (F1 does not send me to the next block of code)
second - if on leave trigger does not find available record I get the error message, but can not get back to the browse.

This is the last piece of this puzzle that I'm working on, if anyone has any ideas, i would appreciate the input.

Thanks in advance.

code looks like this:

def query jobfunc for bempfunc SCROLLING.
define browse func
query jobfunc NO-WAIT
display bempfunc.bfcde bempfunc.bfjob enable all
with 10 down no-box.
define fram job
func
with title "Job Functions" row 9.

mfcode = bempfunc.bfcde:handle in browse func.
mfjob = bempfunc.bfjob:handle in browse func.
ON ENTRY OF BROWSE FUNC DO:
ON TAB EDITOR-TAB.
END.
define fram mm
fcode label "Function Type"
fjob label "Job"
with row 9.
ON leave of bempfunc.bfcde in browse func DO:
FIND FIRST BFUNC WHERE BFUNC.BFCDE =MFCODE:SCREEN-VALUE NO-LOCK NO-ERROR.
IF NOT AVAILABLE BFUNC THEN DO:
DISPLAY "Invalid Function Type".
RETURN NO-APPLY.
END.
do transaction:
get current jobfunc exclusive-lock no-wait.
assign input browse func bempfunc.bfcde bempfunc.bfjob.
end.
get current jobfunc no-lock.
end.
FORM
BEMP.BFSTNME SKIP
BEMP.BLSTNME SKIP
BEMP.BDEPT SKIP
BEMP.BPHONE SKIP
BEMP.BEXT SKIP
BEMP.BACTIVE SKIP(2)
WITH FRAM H NO-BOX.

Prompt-for "Add New Employee(A) or Modify Existing Employee(M)?" mchoice
with fram z no-labels.
assign mchoice = input fram z mchoice.
If mchoice = "M" then RUN MODIFY.
Else if mchoice = "A" then do:
.....(code to create new employee record)
END.
PROCEDURE MODIFY:
...(code to update existing employee department, ext, etc)
END PROCEDURE.

open query jobfunc
for each bempfunc where BEMPFUNC.blstnme = MLAST AND BEMPFUNC.BFSTNME = MFIRST.
enable func WITH fram job.
wait-for close of current-window.
 

MHotovec

Member
First, let me preface this with the fact that what follows is merely an educated guess. With equal emphasis on 'guess' as well as 'educated'. ;)

After your error statement when you can't get back to the browse, try adding
apply 'entry' to bempfunc.bfcde in frame jobfunc .
That would be before 'return no-apply'.

As for leaving the browser. I don't see anything that satisfies the wait-for statement. I suspect the program is still waiting for the close of current-window.
Perhaps something along the lines of;
on f1 of frame jobfunc
apply 'close' to current-window.

Now on to a pet peeve of mine, (stepping onto the soap-box now). In my department I discourage the use of 'wait-for close of current-window' in favor of 'wait-for close of frame {framename}'.
Two reasons for this.
1 (that I can't explain) I've had code that misbehaved with the wait-for current-window line, but as soon as I changed it to wait-for frame it worked correctly (I dunno...).
2 From a debugging point of view, it's MUCH easier to see what's being waited-for when a frame name is specified. And it's also easier to find when the wait-for is satisfied.
(now stepping off soap-box)

Hope any or all of this helps!

Mark

melmckee72 said:
working in 9.1a chui environment

working with updateable browse and having trouble with 2 things.

first - if on leave trigger finds available record can not leave the browse (F1 does not send me to the next block of code)
second - if on leave trigger does not find available record I get the error message, but can not get back to the browse.

This is the last piece of this puzzle that I'm working on, if anyone has any ideas, i would appreciate the input.

Thanks in advance.

code looks like this:

def query jobfunc for bempfunc SCROLLING.
define browse func
query jobfunc NO-WAIT
display bempfunc.bfcde bempfunc.bfjob enable all
with 10 down no-box.
define fram job
func
with title "Job Functions" row 9.

mfcode = bempfunc.bfcde:handle in browse func.
mfjob = bempfunc.bfjob:handle in browse func.
ON ENTRY OF BROWSE FUNC DO:
ON TAB EDITOR-TAB.
END.
define fram mm
fcode label "Function Type"
fjob label "Job"
with row 9.
ON leave of bempfunc.bfcde in browse func DO:
FIND FIRST BFUNC WHERE BFUNC.BFCDE =MFCODE:SCREEN-VALUE NO-LOCK NO-ERROR.
IF NOT AVAILABLE BFUNC THEN DO:
DISPLAY "Invalid Function Type".
RETURN NO-APPLY.
END.
do transaction:
get current jobfunc exclusive-lock no-wait.
assign input browse func bempfunc.bfcde bempfunc.bfjob.
end.
get current jobfunc no-lock.
end.
FORM
BEMP.BFSTNME SKIP
BEMP.BLSTNME SKIP
BEMP.BDEPT SKIP
BEMP.BPHONE SKIP
BEMP.BEXT SKIP
BEMP.BACTIVE SKIP(2)
WITH FRAM H NO-BOX.

Prompt-for "Add New Employee(A) or Modify Existing Employee(M)?" mchoice
with fram z no-labels.
assign mchoice = input fram z mchoice.
If mchoice = "M" then RUN MODIFY.
Else if mchoice = "A" then do:
.....(code to create new employee record)
END.
PROCEDURE MODIFY:
...(code to update existing employee department, ext, etc)
END PROCEDURE.

open query jobfunc
for each bempfunc where BEMPFUNC.blstnme = MLAST AND BEMPFUNC.BFSTNME = MFIRST.
enable func WITH fram job.
wait-for close of current-window.
 

melmckee72

New Member
Thank you so much. These were exactly the problems, one last thing I had to do was add a view frame statment before the "return no-apply" and bingo it works.

MHotovec said:
First, let me preface this with the fact that what follows is merely an educated guess. With equal emphasis on 'guess' as well as 'educated'. ;)

After your error statement when you can't get back to the browse, try adding
apply 'entry' to bempfunc.bfcde in frame jobfunc .
That would be before 'return no-apply'.

As for leaving the browser. I don't see anything that satisfies the wait-for statement. I suspect the program is still waiting for the close of current-window.
Perhaps something along the lines of;
on f1 of frame jobfunc
apply 'close' to current-window.

Now on to a pet peeve of mine, (stepping onto the soap-box now). In my department I discourage the use of 'wait-for close of current-window' in favor of 'wait-for close of frame {framename}'.
Two reasons for this.
1 (that I can't explain) I've had code that misbehaved with the wait-for current-window line, but as soon as I changed it to wait-for frame it worked correctly (I dunno...).
2 From a debugging point of view, it's MUCH easier to see what's being waited-for when a frame name is specified. And it's also easier to find when the wait-for is satisfied.
(now stepping off soap-box)

Hope any or all of this helps!

Mark
 
Top