OWNER problem

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

OWNER problem

#1 Post 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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: OWNER problem

#2 Post 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
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: OWNER problem

#3 Post 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
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: OWNER problem

#4 Post by c-tec »

Hello,
strange, I removed now AUTOFOCUS and the propblem still remains.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: OWNER problem

#5 Post 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.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: OWNER problem

#6 Post 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')
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: OWNER problem

#7 Post by c-tec »

Hello Roger,
thank you, works now !
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply