Page 1 of 2

Owner's windows

Posted: Tue Jan 27, 2015 10:05 am
by Janko
Dear Roger,

I have an application in which there is an array browse (plus some buttons for other actions) in dialog window 'A' created via DCREAD GUI. Pressing a button a new dialog 'B' is open also via DCREADGUI and tree browse is running in.

I want NO MODALITY, but dialog 'B' should remain on top all the time.
I want to create another (second) dialog 'B' while 'A' remains open and third ....
Dialog 'B' should not be constrained to drawingArea of 'A'

When I press close button in titlebar of 'A' I want all 'B' dialogs to be closed, 'B' dialogs should be able to be closed individually in any order - so first created, could be closed first, rest of 'B' remain open.

I experimented with following from DcGetOptions:

Code: Select all

DCGETOPTIONS ;
   SAYFONT '7.Courier' ;
   SAYWIDTH 350 ;
   TABSTOP ;
   AUTORESIZE ALWAYSONTOP LOCKWINDOWTOOWNER

DCREAD GUI ;
   FIT ;
   ADDBUTTONS SETAPPWINDOW ;
   OPTIONS GetOptions ;
   TITLE 'Skupina - material - kupec ' + mleto    EVAL {||BuildTree(oTree,aRRc)}
  
I want to achieve same behaviour as dialogue Windows from Alaska's samples 'OwnerWin', but with the tools from Express.
What am I doing wrong?


Best regards
Janko

Re: Owner's windows

Posted: Tue Jan 27, 2015 11:41 am
by rdonnay
In the A window you will need a pointer to all the B windows.

Are these windows all running in the same thread?

Re: Owner's windows

Posted: Tue Jan 27, 2015 12:30 pm
by Janko
Roger,

yes, Windows are running in one thread.

BR
Janko

Re: Owner's windows

Posted: Thu Jan 29, 2015 12:17 am
by Janko
Roger,

it looks like I made no significant progress. Can I ask you to give me mor specific hints? Or even a sample?

Best regards
JAnko

Re: Owner's windows

Posted: Thu Jan 29, 2015 3:00 am
by PedroAlex
Janko.

take a look into :
\ALASKA\XPPW32\SOURCE\samples\basics\WINDOWS

Maybe can help.

Pedro

Re: Owner's windows

Posted: Thu Jan 29, 2015 4:45 am
by Janko
Pedro,

thanks for your answer. I could use Alaska's sample, I've studied it.
But I intended to solve the problem with eXpress tools. They offer extra comfort creating XBP parts, but less options (???) to control them.
That was the reason I asked Roger for sugesstions.

BR J.

Re: Owner's windows

Posted: Thu Jan 29, 2015 5:28 am
by PedroAlex
Can you Try This:

Code: Select all

DCGETOPTIONS ;
   SAYFONT '7.Courier' ;
   SAYWIDTH 350 ;
   TABSTOP ;
   AUTORESIZE ALWAYSONTOP LOCKWINDOWTOOWNER 


DCREAD GUI ;
   FIT ;
   ADDBUTTONS SETAPPWINDOW ;
   OPTIONS GetOptions ;
   TITLE 'Skupina - material - kupec ' + mleto  ;
   PARENT @oDlg ;
   EVAL {||BuildTree(oTree,aRRc)  ,;
               oDlg:close  := {|mp1,mp2,obj| obj:destroy()     }
  

Re: Owner's windows

Posted: Thu Jan 29, 2015 7:06 am
by Janko
Pedro,

it could not work because PARENT of next window is previous one.
So all windows are stacked.

Thanks anyway
BR J.

Re: Owner's windows

Posted: Thu Jan 29, 2015 12:57 pm
by rdonnay
Try this test program. It may give you some ideas.

Code: Select all

#INCLUDE "dcdialog.ch"

FUNCTION Main()

LOCAL GetList[0]

PRIVATE oWindowA, oWindowB, oWindowC

@ 0,0 DCSAY 'This is Window A' SAYSIZE 0 FONT '20.Arial Bold'

DCREAD GUI FIT TITLE 'Window A' EVAL {|o|M->oWindowA := o, WindowB()}

IF Valtype(M->oWindowB) == 'O'
  M->oWindowB:destroy()
ENDIF

IF Valtype(M->oWindowC) == 'O'
  M->oWindowC:destroy()
ENDIF

wtf 'stop' pause

RETURN nil

* -----------

FUNCTION WindowB()

LOCAL GetList[0], GetOptions, oDlg

@ 0,0 DCSAY 'This is Window B' SAYSIZE 0 FONT '20.Arial Bold'

DCGETOPTIONS WINDOWROW 500 WINDOWCOL 900

DCREAD GUI FIT TITLE 'Window B' ;
   OPTIONS GetOptions ;
   PARENT @oDlg ;
   EXIT

M->oWindowB := oDlg
oDlg:close := {|a,b,o|o:destroy(),M->oWindowB := nil }
WindowC()

RETURN nil

* -----------

FUNCTION WindowC()

LOCAL GetList[0], GetOptions, oDlg

@ 0,0 DCSAY 'This is Window C' SAYSIZE 0 FONT '20.Arial Bold'

DCGETOPTIONS WINDOWROW 400 WINDOWCOL 800

DCREAD GUI FIT TITLE 'Window C' ;
   OPTIONS GetOptions ;
   EXIT ;
   PARENT @oDlg

M->oWindowC := oDlg
oDlg:close := {|a,b,o|o:destroy(),M->oWindowC := nil }

RETURN nil

* --------

PROC appsys ; RETURN

Re: Owner's windows

Posted: Sat Jan 31, 2015 12:09 am
by Janko
Roger thank you,
that is exactly what I was looking for.

Best regards
JAnko