Page 1 of 1
MsgInfo()
Posted: Thu Jan 23, 2014 2:11 am
by hmgchang
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
Re: MsgInfo()
Posted: Thu Jan 23, 2014 1:30 pm
by srvet_claudio
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
Hi 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.
Re: MsgInfo()
Posted: Fri Jan 24, 2014 6:37 pm
by srvet_claudio
Hi Chang,
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
MsgInfo()
Posted: Fri Jan 24, 2014 10:51 pm
by Pablo César
Fantastico !
Gracias, Dr. Soto !

Re: MsgInfo()
Posted: Sat Jan 25, 2014 12:08 am
by Javier Tovar
Dr. Soto gracias por compartir, esta excelente! Fantástico!
Saludos