English

Problem: Making changes to one GUI changes another GUI automatically

Description

The control items for a GUI appear the same as the control items for another GUI. Also, making a change to a GUI, such as changing the name of a control or setting a Click Event, changes another GUI that was not touched.

Cause

An Avenue script was used to update both GUIs with the same parameters. A control object can only be in one DocGUI. To add the same control, or menu, to more than one DocGUI, the script must clone the control and menu.

Solution or Workaround

Remove the offending control from both GUIs. Change your Avenue code to clone the control before adding to each GUI. Use the Avenue script below as an example.

Code:
'-- This sample script shows you how to avoid duplicates.

'-- To add the same control or menu to more than one
'-- DocGUI, the script must clone the control and menu.
'-- A control object can only be in one DocGUI.

viewMenuBar = av.FindGUI("View").GetMenuBar
layoutMenuBar = av.FindGUI("Layout").GetMenuBar

m = Menu.Make
m.SetLabel("Printer")
c = Choice.Make
c.SetLabel("Test")
c.SetClick("Test.View")
m.Add(c,0)

viewMenuBar.Add(m,0)

'-- Clone the menu object m before adding it to the layout menu bar.
'-- You don't need to explicitly clone the choice object c
'-- because the clone on the menu takes care of that.

layoutMenuBar.Add(m.Clone,0)

'-- Change the click script to Test.Layout
layoutMenuBar.FindByScript("Test.View").SetClick("Test.Layout"


Note:
Refer to the online Help for details on using DocGUIs.