Hello,
have a customer with a special request. He want's to get a main window and a modal window, where it is impossible to move the modal window out of the border of the calling window. Better would be that the modal window can be moved over the border and is invisible out of the border of the main window. The same behaviour is in for example in EXCEL. Is this possible with eXPress++ ?
regards
Rudolf
Preventing modal windows from overlapping
Re: Preventing modal windows from overlapping
It is possible to anchor a modal window to a SetAppWindow(), but I wouldn't know how to make it start disappearing when moved to an area of the screen. What happens when it completely disappears? It seems that you would lockup the application if a modal window was not visible.
The eXpress train is coming - and it has more cars.
Re: Preventing modal windows from overlapping
Hello Roger,
I will try it later with EXCEL what happens if the window is completley out of the parent window. But it would be enough when the window cannot be moved over the owner window. Is this possible ? I
regards
Rudolf
I will try it later with EXCEL what happens if the window is completley out of the parent window. But it would be enough when the window cannot be moved over the owner window. Is this possible ? I
regards
Rudolf
Re: Preventing modal windows from overlapping
Yes, this is possible, but I have some questions.
What is the exact behavior you are looking for?
Do you want the modal windows to automatically center itself over the owner and then not allow it to be moved at all?
If you want to allow some movement, how do you want it restricted?
What is the exact behavior you are looking for?
Do you want the modal windows to automatically center itself over the owner and then not allow it to be moved at all?
If you want to allow some movement, how do you want it restricted?
The eXpress train is coming - and it has more cars.
Re: Preventing modal windows from overlapping
This does the job. The modal window can't be moved outside the parent dialog:
Code: Select all
#include "dcdialog.ch"
#pragma library("dclipx.lib")
PROCEDURE appsys() ; RETURN
PROCEDURE MAIN()
LOCAL GetList := {}, GetOptions := {}, oDialog
@ 1,1 DCSAY 'Blabla' SIZE 100,28
@ 29,1 DCPUSHBUTTON CAPTION 'New Window' SIZE 15,1 ACTION {||NewWindow(oDialog)}
DCREAD GUI FIT PARENT @oDialog ADDBUTTONS OPTIONS GetOptions EVAL {|o|SetAppWindow(o)}
RETURN
PROCEDURE NewWindow(oOwner)
LOCAL GetList := {}, GetOptions := {}, oDialog,oBlaBla, oBlaBla2
@ 1,1 DCSAY 'More blabla' SIZE 70,15 OBJECT oBlaBla
@ 2,1 DCSAY 'Lots of blabla' SIZE 70,15 OBJECT oBlaBla2
DCREAD GUI FIT MODAL ;
EVAL {|o|o:Move := {|aOld,aNew,oWindow|DontMoveOutSide(aOld,aNew,oWindow,oOwner,oBlaBla,oBlaBla2)}} ;
PARENT @oDialog OWNER oOwner
RETURN
FUNCTION DontMoveOutSide(aOld,aNew,oWindow,oOwner,oBlaBla,oBlaBla2)
LOCAL lResetPos := .F.
oBlaBla:SetCaption('Old: '+Trim(str(aOld[1]))+"/"+Trim(str(aOld[2]))+' New: '+;
Trim(str(aNew[1]))+"/"+Trim(str(aNew[2]))+' Size: '+;
Trim(str(oWindow:CurrentSize()[1]))+"/"+Trim(str(oWindow:CurrentSize()[2])))
oBlaBla2:SetCaption(' Size Parent: '+Trim(str(oOwner:CurrentSize()[1]))+"/"+Trim(str(oOwner:CurrentSize()[2]))+;
' Pos Parent: '+Trim(str(oOwner:CurrentPos()[1]))+"/"+Trim(str(oOwner:CurrentPos()[2])))
IF aNew[1] < oOwner:CurrentPos()[1]
aNew[1] := oOwner:CurrentPos()[1]
lResetPos := .T.
ENDIf
IF aNew[2] < oOwner:CurrentPos()[2]
aNew[2] := oOwner:CurrentPos()[2]
lResetPos := .T.
ENDIf
IF aNew[1]+oWindow:CurrentSize()[1] > oOwner:CurrentPos()[1]+oOwner:CurrentSize()[1]
aNew[1] := (oOwner:CurrentPos()[1]+oOwner:CurrentSize()[1])-oWindow:CurrentSize()[1]
lResetPos := .T.
ENDIf
IF aNew[2]+oWindow:CurrentSize()[2] > oOwner:CurrentPos()[2]+oOwner:CurrentSize()[2]
aNew[2] := (oOwner:CurrentPos()[2]+oOwner:CurrentSize()[2])-oWindow:CurrentSize()[2]
lResetPos := .T.
ENDIf
IF lResetPos
oWindow:SetPos(aNew)
ENDIF
RETURN NIL
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
Re: Preventing modal windows from overlapping
Hello Tom,
thank you, works perfect, maybe Roger can make something in DCGETOPTIONS
regards
Rudolf
thank you, works perfect, maybe Roger can make something in DCGETOPTIONS
regards
Rudolf
Re: Preventing modal windows from overlapping
That sound like a good option. I'll add it to build 255.
Thanks, Tom.
Thanks, Tom.
The eXpress train is coming - and it has more cars.
Re: Preventing modal windows from overlapping
Hello Roger,
thank you !
regards
Rudolf
thank you !
regards
Rudolf
Re: Preventing modal windows from overlapping
What should I call this option?
BLABLA
or
MORE BLABLA
BLABLA
or
MORE BLABLA
The eXpress train is coming - and it has more cars.
Re: Preventing modal windows from overlapping
Hello Roger,
maybe MOVELOCK
regards
Rudolf
maybe MOVELOCK
regards
Rudolf