MsgInfo()

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

MsgInfo()

Post 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
Just Hmg It !
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: MsgInfo()

Post 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.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: MsgInfo()

Post 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
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

MsgInfo()

Post by Pablo César »

Fantastico !

Gracias, Dr. Soto ! :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: MsgInfo()

Post by Javier Tovar »

Dr. Soto gracias por compartir, esta excelente! Fantástico! :D

Saludos
Post Reply