Page 1 of 1

Center MsgXxx () in a not center (in desktop) form...

Posted: Thu Mar 24, 2022 6:11 am
by Claudio Ricardo
Hi, I need to center the messages in the main window, so I do:

Code: Select all

// This variables declared PRIVATE at start

	cbMainCenterRow := { || ( Main.Row + ( Main.Height / 2 )) - 100 }
	cbMainCenterCol := { || ( Main.Col + ( Main.Width / 2 )) - 200 }

	Set DialogBox Row cbMainCenterRow Col cbMainCenterCol

END WINDOW
    Main.Activate
Here I assume that MsgXxx will be 200h x 400w px. and align it well, but what about short msgs ?
Is there a way to know what size the Msg window will have, to put it in the codeblock ?
Something like I do with any window: Form_xx.CenterIn ( Main ) ?
It's not something important, but it would look neater !
As always, thanks in advance for any suggestions or help.

Re: Center MsgXxx () in a not center (in desktop) form...

Posted: Thu Mar 24, 2022 2:12 pm
by andyglezl
Maybe...

PadC( <xVal>, <nWidth>, <cFill> ) → cString

Re: Center MsgXxx () in a not center (in desktop) form...

Posted: Thu Mar 24, 2022 5:10 pm
by Claudio Ricardo
Hola Andy, gracias por contestar, te refieres a rellenar con espacios el texto que mostrará el MsgXxx
para que siempre la ventana del control tenga el mismo ancho ?
Lo que deseo hacer es centrarlo en la ventana main como si fuera cualquier otra ventana en la que puedo usar:
Form_1.CenterIn ( Main )... algo asi como: Set DialogBox CenterIn ( Main )

Re: Center MsgXxx () in a not center (in desktop) form...

Posted: Thu Mar 24, 2022 8:09 pm
by andyglezl
Creo que por defecto todos los MsgXxx() salen centrados en el Escritorio... :roll:
sin utilizar: Set DialogBox Row cbMainCenterRow Col cbMainCenterCol

O te refieres al tamaño de una ventana en especifico ?

Porque si se mueve la ventana, abría que estarla "siguiendo" para centrar donde esté ...

Ya probaste con esto ?

SET DIALOGBOX [ POSITION ] CENTER OF PARENT

Re: Center MsgXxx () in a not center (in desktop) form...

Posted: Fri Mar 25, 2022 9:21 am
by Claudio Ricardo
Muchas gracias Andy, Funcionó así: SET DialogBox Center Of Parent
sin especificar nada en [ POSITION ]