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
Strange SET DIALOGBOX POSITION behaviour
Moderator: Rathinagiri
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: Center POSITION to Parent Window
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Strange SET DIALOGBOX POSITION behaviour
Ok, thank you Claudio.
Just FYG, in this topic (same topic): you said "nice" (as probably in agree with that) and
with certainty: not predicting _HMG_MainWindowFirst==.F. which will certainly occur a runtime error.
The change, centralization still maintains the option to position the _Input_Window where the user wants,
through the additional parameters of row / col.
Just FYG, in this topic (same topic): you said "nice" (as probably in agree with that) and
with certainty: not predicting _HMG_MainWindowFirst==.F. which will certainly occur a runtime error.
The change, centralization still maintains the option to position the _Input_Window where the user wants,
through the additional parameters of row / col.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Re: Center POSITION to Parent Window
Thank you for improving my version Pablo ! Hopefully it will be included in the next HMG release !Pablo César wrote:trmpluym wrote:Also the following functions ...
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
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
Strange SET DIALOGBOX POSITION behaviour
It's a pleasure Theo. I hope so too...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: Strange SET DIALOGBOX POSITION behaviour
Thanks Pablo and Theo !
Serge
Serge
There's nothing you can do that can't be done...
Re: Strange SET DIALOGBOX POSITION behaviour
Hi friends,
I never got a reply with the solution for this problem. But finally I found the solution my selves !
And like often, a good solution is simple. Here the code with the strange behavior:
This code seems not to respect:
SET DIALOGBOX POSITION CENTER OF <Parent>
And here the code that does:
So the only required change was to add ‘ + MB_TOPMOST ‘
So hopefully this saves anybody else some time (and frustration )
Theo
I never got a reply with the solution for this problem. But finally I found the solution my selves !
And like often, a good solution is simple. Here the code with the strange behavior:
Code: Select all
IF MessageBoxTimeout('Quit program ?','Quit?',MB_ICONQUESTION + MB_YESNO) == IDYES
Return(.T.)
ENDIF
SET DIALOGBOX POSITION CENTER OF <Parent>
And here the code that does:
Code: Select all
IF MessageBoxTimeout('Quit program ?','Quit?',MB_ICONQUESTION + MB_YESNO + MB_TOPMOST) == IDYES
Return(.T.)
ENDIF
So hopefully this saves anybody else some time (and frustration )
Theo
- Attachments
-
- Solution.zip
- (1.47 MiB) Downloaded 180 times