Re: Center POSITION to Parent Window
Posted: Thu Dec 15, 2016 12:33 am
I will think about it !Pablo César wrote:I think the InputBox and InputWindow functions should always be based on the Parent Window because it is the window that called it and if the programmer has defined a specific Form position (non Window Parent centralized) the InputBox and InputWindow should consider the centering as the base/default window (Parent Window). You can still change the row and column as optional parameters as already exists.trmpluym wrote:Also the following functions ...
InputWindow
InputBox
The last one is always centered, the first you can change the row and the column.
...
nRow and nCol are optional. When nRow or nCol are 0 the InputWindow is positioned in the center of the screen.
With the modification i made the functionality stays the same but when nRow of nCol is a negative number (<0) the InputWindow is positioned in the center of the parent form.
Maybe an idea to include in the next release?
This idea is great but there is an objection. cParentWindowName assigning can It may fail when Window Parent does not exist.trmpluym wrote:I changed the source file c:\hmg.3.4.3\SOURCE\h_controlmisc.prg with only four lines to add the possibility to center the InputWindow in the parent window.
The lines i added are line 3099 ...
... and 3876 to 3878Code: Select all
Local cParentWindowName:=ThisWindow.Name
Code: Select all
If nRow < 0 .or. nCol < 0 CENTER WINDOW _InputWindow IN &cParentWindowName EndIf
Remembering that the user has the possibility to use:
SET WINDOW MAIN OFF I use a lot. Especially when I need to do some tests.Code: Select all
Function Main() SET WINDOW MAIN OFF MsgInfo ( InputBox ( 'Renovación del condominio anual para todos los asociados y con accion de la justicia para los que deben:' , 'InputBox Demo' , 'Default Value' , , , ,700 ) ) SET WINDOW MAIN ON Return Nil
So, to attend also that cases at Local cParentWindowName:=ThisWindow.Name, we can make this instead:
and to center the window:Code: Select all
Local cParentWindowName:=If(_HMG_MainWindowFirst==.T.,ThisWindow.Name,"")
What do you thing Claudio ? We can centralized InputBox and InputWindow in Parent Window instead negatives value ? And make respective conditional for preventing case of SET WINDOW MAIN OFF in both functions ?Code: Select all
If _HMG_MainWindowFirst==.T. CENTER WINDOW _InputBox IN &cParentWindowName Else CENTER WINDOW _InputBox DESKTOP Endif