On the dialog "A" there is a control - xBrowser. In the process of work I need to copy it to the dialog "B" (ocopy())/.
How can I do this ?
How can I do this ?
Will both dialogs be visible at the same time ?
Maybe you can just change the parent of the control using SetParent()
Yes, both dialogs are visible at the same time. And each will have its own (similar in structure) xBrowse. In this case SetParent is not suitable
oNew:=ocopy(oDlg_1:aControls[1])
aadd(oDlg_2:aControls, oNew)
oDlg_2:Refresh()#include "FiveWin.ch"
function Main()
USE customer
XBROWSER SETUP BrwSetup( oBrw )
return nil
function BrwSetup( oBrw )
local oDlg, oBrw2, hWnd
DEFINE DIALOG oDlg SIZE 800, 600
@ 1, 1 XBROWSE oBrw2 OF oDlg SIZE 600, 500
oBrw2:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED NOWAIT ;
ON INIT ( hWnd := oBrw2:hWnd, oBrw2 := OClone( oBrw ), oBrw2:hWnd := hWnd, oBrw2:oWnd := oDlg, .T. )
return niloCtl:=ocopy(oDlg_1:aControls[1])
oDlg_2:AddControl(oCtl)Ok, but it strikes me that you don't have to change the xbrowse oWnd ( parent ) to the new destination oDlg
When you add the xbrowse object to the list of controls of the new dialog, that may be correct, but the oWnd data of the xbrowse object still holds the previous oDlg object.
oCtl:=ocopy(oDlg_1:aControls[1])
oCtl:oWnd:=oDlg_2
oDlg_2:AddControl(oCtl)