Page 1 of 1
OWNER problem
Posted: Sat May 14, 2016 10:17 pm
by c-tec
Hello,
I have a parent dialog with
DCREAD GUI FIT PARENT @oDlg
from this dialog I call another one with
DCREAD GUI FIT OWNER oDlg
The window appears correct, but when I click on the parent dialog (oDlg) and go back to the other window, I cannod edit the values anymore. The focus keeps on the parent dialog. But when I click something outside the application like desktop and go back to the second window, I can edit the values and it works correct. What's goes wrong here ? I use the latest eXpress++ version and 1.9SL1
regards
Rudolf
Re: OWNER problem
Posted: Sun May 15, 2016 12:50 pm
by rdonnay
I tested using the below sample code. It works as expected.
How is your code different?
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList[0], oDlg
@ 0,0 dcpushbutton caption 'Open window' size 15,2 ;
action {||OpenWindow(oDlg)}
DCREAD GUI TITLE 'Main Window' PARENT @oDlg
RETURN nil
* ---------
PROC appsys ; RETURN
* ---------
STATIC FUNCTION OpenWindow(oDlg)
LOCAL GetList[0], aGets[10], i
AFill(aGets,' ')
FOR i := 1 TO Len(aGets)
@ i,0 DCGET aGets[i]
NEXT
DCREAD GUI FIT OWNER oDlg
RETURN nil
Re: OWNER problem
Posted: Mon May 16, 2016 10:54 pm
by c-tec
Hello Roger,
found that AUTORESTORE makes the problem, if you open the parent window and click once in the main window, you never get focus on the child window anymore. You can click in the child window, but cannot change values in the get for example.
regards
Rudolf
Code: Select all
#include "dcdialog.ch"
#include "Appevent.ch"
* ------------
PROC appsys ; return
* ------------
Procedure Main()
LOCAL GetList[0], GetOptions, oMenuBar, oMenuFile, oDlg ,nVar := 0
local aData := {},oBrowse1
aadd(aData,{1,"Col1","Col2","Col2"})
aadd(aData,{2,"Col1","Col2","Col2"})
aadd(aData,{3,"Col1","Col2","Col2"})
DCMENUBAR oMenuBar
DCSUBMENU oMenuFile PROMPT 'Click Me' PARENT oMenuBar
DCMENUITEM 'Open First Child Window' PARENT oMenuFile ACTION {|| Win_01(oDlg) }
DCMENUITEM 'Exit' PARENT oMenuFile ACTION {|| PostAppEvent( xbeP_Quit ) }
@ 1,1 DcSay 'This is the main Window' SAYFONT '9.Arial Bold' SAYSIZE 40,1
@ 2,1 DcSay 'Get' get nVar pict "999" saysize 0
@ 3,1 DCBROWSE oBrowse1 DATA aData SIZE 100,10
DCBROWSECOL ELEMENT 1 WIDTH 4 HEADER "ID" PARENT oBrowse1
DCBROWSECOL ELEMENT 2 WIDTH 4 HEADER "Col1" PARENT oBrowse1
DCBROWSECOL ELEMENT 3 WIDTH 4 HEADER "Col2" PARENT oBrowse1
DCBROWSECOL ELEMENT 4 WIDTH 4 HEADER "Col2" PARENT oBrowse1
DCGETOPTIONS AUTOFOCUS
DCREAD GUI FIT TITLE 'Main' OPTIONS GetOptions Parent @oDlg
RETURN
Procedure Win_01(xoDlg)
******************************************************************
LOCAL GetList:={}, oDlg1,aData := {},oBrowse1 ,nVar := 0
aadd(aData,{1,"Col1","Col2","Col2"})
aadd(aData,{2,"Col1","Col2","Col2"})
aadd(aData,{3,"Col1","Col2","Col2"})
@ 1,1 DcSay 'This is Child Window 1' SAYFONT '9.Arial Bold' SAYSIZE 40,1
@ 2,1 DcSay 'Get' get nVar pict "999" saysize 0
@ 3,1 DCBROWSE oBrowse1 DATA aData SIZE 100,10
DCBROWSECOL ELEMENT 1 WIDTH 4 HEADER "ID" PARENT oBrowse1
DCBROWSECOL ELEMENT 2 WIDTH 4 HEADER "Col1" PARENT oBrowse1
DCBROWSECOL ELEMENT 3 WIDTH 4 HEADER "Col2" PARENT oBrowse1
DCBROWSECOL ELEMENT 4 WIDTH 4 HEADER "Col2" PARENT oBrowse1
DCREAD GUI FIT TITLE 'Window 01' OWNER xoDlg Parent @oDlg1
Return
Re: OWNER problem
Posted: Mon May 16, 2016 11:08 pm
by c-tec
Hello,
strange, I removed now AUTOFOCUS and the propblem still remains.
regards
Rudolf
Re: OWNER problem
Posted: Tue May 17, 2016 8:07 am
by rdonnay
I can confirm the problem with your sample.
I don't see why AUTOFOCUS would cause this.
I'll see what I can do.
Re: OWNER problem
Posted: Tue May 17, 2016 8:41 am
by rdonnay
I think I have a fix for you.
There is a mechanism within eXpress++ that sets focus to the last object that had focus when it's parent dialog gets input focus. This causes the problem only when there are 2 or more dialog windows that are running in the same thread. I decided that this feature needs to be disabled when the dialog receiving input focus or display focus has an owner dialog of DC_XbpDialog1 class.
This fix corrects the problem in your sample.
Make the following change to _DCGETBX.PRG (line 4534)
Code: Select all
WAS:
IF oGetList:lastFocus:status() == XBP_STAT_CREATE
IS:
IF oGetList:lastFocus:status() == XBP_STAT_CREATE .AND. !oXbp:owner:isDerivedFrom('DC_XbpDialog1')
Re: OWNER problem
Posted: Wed May 18, 2016 12:29 am
by c-tec
Hello Roger,
thank you, works now !
regards
Rudolf