Dear Sirs,
Is there a way to position (row/col) the MsgInfo() or MsgDebug() function within window/form ?
MsgInfo() form always appears at the center of the desktop, instead of the window/form that call .
thks n rgds
Chang
MsgInfo()
Moderator: Rathinagiri
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: MsgInfo()
Hi Chang,hmgchang wrote:Dear Sirs,
Is there a way to position (row/col) the MsgInfo() or MsgDebug() function within window/form ?
MsgInfo() form always appears at the center of the desktop, instead of the window/form that call .
thks n rgds
Chang
MsgInfo, MsgDebug, etc, are modal dialog boxes that require a low-level hook procedure to change its position on the screen.
Best regards,
Claudio.
- srvet_claudio
- Posts: 2193
- Joined: Thu Feb 25, 2010 8:43 pm
- Location: Uruguay
- Contact:
Re: MsgInfo()
Hi Chang,
see this demo:
see this demo:
Code: Select all
// By Dr. Claudio Soto, January 2014
#include "hmg.ch"
Function Main
PUBLIC MsgDlg_y := NIL
PUBLIC MsgDlg_x := NIL
#xtranslate SET DIALOG [ROW <nRow> COL <nCol>] => SETDIALOG_POS ( <nRow> , <nCol> )
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 500 HEIGHT 300 ;
TITLE 'MessageBox Move' ;
MAIN
@ 100,100 BUTTON Button_1 CAPTION "Dlg Move" ACTION ( SET DIALOG ROW 10 COL 10 , MsgInfo ("Hello 1") )
@ 200,100 BUTTON Button_2 CAPTION "Dlg NoMeve" ACTION ( SET DIALOG , MsgInfo ("Hello 2") )
END WINDOW
CREATE EVENT PROCNAME MessageBoxMove()
Form_1.Center()
Form_1.Activate()
Return Nil
Function SETDIALOG_POS ( nRow, nCol )
MsgDlg_y := nRow
MsgDlg_x := nCol
RETURN NIL
Function MessageBoxMove()
LOCAL hWnd, x, y
hWnd := GetActiveWindow()
IF GetWindowInfoByHandle ( hWnd ) == "" .AND. MsgDlg_x <> NIL .AND. MsgDlg_y <> NIL
#define SWP_NOSIZE 0x0001
#define SWP_NOOWNERZORDER 0x0200
SETWINDOWPOS ( hWnd, 0, MsgDlg_x, MsgDlg_y, 0, 0, SWP_NOOWNERZORDER + SWP_NOSIZE )
ENDIF
Return NIL
- Pablo César
- Posts: 4059
- Joined: Wed Sep 08, 2010 1:18 pm
- Location: Curitiba - Brasil
MsgInfo()
Fantastico !
Gracias, Dr. Soto !
Gracias, Dr. Soto !
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
-
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: MsgInfo()
Dr. Soto gracias por compartir, esta excelente! Fantástico!
Saludos
Saludos