Scrolling form in a parent child situation 
Author Message
 Scrolling form in a parent child situation

I have a Parent-Child relationship between two files. The main browse uses
the Window template and has one browse box on top showing the parent file
records and one below showing the related child records for the highlighted
parent record. When the update proc is called, the parent record fields are
presented for edit and the related child records appear in another bowse
box at the bottom of the Form with Insert, Change and Delete buttons.

I am using the FrameBrowseControl template and, since I want to be able to
use this as a scrolling form, I have SetToolBarTarget to the Update of the
parent record, using the 'Initialise the Procedure' embed point. This works
fine.

When the Update form for the child records is called, clicking on the
TBarBrwDown button takes the user back to the previous Update form instead
of redisplaying the child record update form with the next record. It also
disables the FrameBrowseControl buttons and I have to close the form and
re-enter it to enable them again.

I feel that the problem is arising because the Toolbar target is not being
set correctly. I have tried using the SetToolbarTarget code template at
various embed points but with no luck so far. I also tried following
through the logic of what happens after the toolbar button is clicked
(using the De{*filter*}) but that got me hopelessly confused.

Have been struggling with this for days. Would be very grateful for some
help

Thanks
Javed Shakoor



Sun, 12 Dec 1999 03:00:00 GMT  
 Scrolling form in a parent child situation

Quote:

>I have a Parent-Child relationship between two files. The main browse uses
>the Window template and has one browse box on top showing the parent file
>records and one below showing the related child records for the highlighted
>parent record. When the update proc is called, the parent record fields are
>presented for edit and the related child records appear in another bowse
>box at the bottom of the Form with Insert, Change and Delete buttons.
>I am using the FrameBrowseControl template and, since I want to be able to
>use this as a scrolling form, I have SetToolBarTarget to the Update of the
>parent record, using the 'Initialise the Procedure' embed point. This works
>fine.
>When the Update form for the child records is called, clicking on the
>TBarBrwDown button takes the user back to the previous Update form instead
>of redisplaying the child record update form with the next record. It also
>disables the FrameBrowseControl buttons and I have to close the form and
>re-enter it to enable them again.
>I feel that the problem is arising because the Toolbar target is not being
>set correctly. I have tried using the SetToolbarTarget code template at
>various embed points but with no luck so far. I also tried following
>through the logic of what happens after the toolbar button is clicked
>(using the De{*filter*}) but that got me hopelessly confused.
>Have been struggling with this for days. Would be very grateful for some
>help
>Thanks
>Javed Shakoor

Hi, I'm not completely clear what you are trying to do, and not sure I
completely understand how the toolbar buttons work, but here's what I
suggest:

1. On you parent update form you want the buttons to be assigned to
the form, not the child browse on entry. Due to the order in which the
fields are processed in generating code you will normally end up with:

Do Form::AssignButtons
Do BRWx::AssignButtons
      IF NOT WindowInitialized
        DO InitializeWindow
        WindowInitialized = True
      END

in Event:OpenWindow. Thus the toolbar is initially assigned to the
browse, but if you click the toolbar buttons when you are not on the
browse, nothing happens.

So, the first thing to accomplish is to assign the toolbar buttons to
the form instead of the browse.

There may be easier ways, but I suggest making the following change to
the Standard.tpw template file (about line 130):

#GROUP(%StandardWindowHandling)
#FOR(%WindowEvent)
  #SUSPEND
#?OF EVENT:%WindowEvent
  #EMBED(%WindowEventHandling,'Window Event Handling'),%WindowEvent
  #CASE(%WindowEvent)
  #OF('OpenWindow')
***** Add this line *****
  #EMBED(%SetButtonAssignonOpen,'Set Toolbar button assign on open')
***** *******
  IF NOT WindowInitialized
    DO InitializeWindow
    WindowInitialized = True
  END

then you can add: do Form::AssignButtons in this embed point. You code
will be a bit redundant, but will work:

Do Form::AssignButtons
Do BRWx::AssignButtons
Do Form::AssignButtons
      IF NOT WindowInitialized
        DO InitializeWindow
        WindowInitialized = True
      END

2. You want to assign the toolbar buttons to the browse when the
browse is selected.

In the Control event handling, before generated code, for the
"Selected" event for the listbox, add:
Do BRWx::AssignButtons

I think this should accomplish what you are trying to do.

----------------------
Jon Waterhouse
Andy Rowe Consultants,
St. John's NF



Sun, 12 Dec 1999 03:00:00 GMT  
 Scrolling form in a parent child situation

Hi Jon,
Thanks for your message, but I am afraid it didn't work.

What I am trying to achieve is that when I click the TBarBrwDown button
while in the child update form it should redisplay the same form with the
next record displayed.

I tried what you suggested but it goes back to the parent update form and
the toolbar target is set to the child browse listbox at the bottom of the
form, which means that the parent update form also loses its ability to be
used as a 'scrolling form'. Clicking on a parent file field in the top
portion of the form seems to disable the toolbar buttons without actually
dimming them.

Javed



Quote:
> Hi, I'm not completely clear what you are trying to do, and not sure I
> completely understand how the toolbar buttons work, but here's what I
> suggest:

> There may be easier ways, but I suggest making the following change to
> the Standard.tpw template file (about line 130):

> In the Control event handling, before generated code, for the
> "Selected" event for the listbox, add:
> Do BRWx::AssignButtons

> I think this should accomplish what you are trying to do.



Mon, 13 Dec 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Parent-child browse scrolling problem

2. SQL - adding child record from parent form

3. Add Child Record Within New Parent Record form.

4. Parent form cleared when EIP child browse

5. delete parent-child record without using form

6. Child browse in parent form

7. I have Update Form (parent file) with Browse List (child file)

8. Update of Parent Form from Child

9. CW4 Writing to a parent file from child file's update form

10. parent-child in a form

11. Update parent value from child form

12. send data form child to parent

 

 
Powered by phpBB® Forum Software