mIRC Home    About    Download    Register    News    Help

Print Thread
Custom-Window centered to mIRC-Window #268422 31/01/21 12:14 PM
Joined: Jan 2021
Posts: 2
D
daniel61 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
D
Joined: Jan 2021
Posts: 2
Hello smile

I am looking for a way to create custom-windows centered relative to mirc-window.
Option -C refers to screen, not mirc. so I used size of mirc-window ($window(-2).w / .h ) to calculate position, but this does not work when mirc-windows is placed on right side of screen.

is there any option/parameter/way to create new custom windows centered to mirc-window?

thanks guys

Re: Custom-Window centered to mIRC-Window [Re: daniel61] #268426 03/02/21 02:52 PM
Joined: Jan 2004
Posts: 1,510
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,510
Does using -1 -1 as the x and y positions do what you wish?

Re: Custom-Window centered to mIRC-Window [Re: daniel61] #268439 05/02/21 05:44 AM
Joined: Dec 2002
Posts: 213
T
Talon Offline
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 213
If I'm following you correctly you're attempting to center a "desktop" window relative to mIRC's position? where -C centers it to the desktop?

I broke this down into a few sections, mIRC's position on the desktop (-2 both .dx and .dy) and mIRC's dimensions on the desktop (-2 .w and .w)
so knowing this, mIRC's position + half of it's dimension = center pixel relative to mIRC's overall size and position on the desktop.

If you know your custom @window's size, then simply taking that position and subtracting half it's dimensions would be the screen coordinates you need to be centered within the mIRC window. Here's a quick example alias demonstrating the effect.

Code
cwt {
  var %mx = $window(-2).dx , %my = $window(-2).dy
  var %mw = $window(-2).w , %mh = $window(-2).h
  var %cw = 320 , %ch = 240 
  var %px = $calc(%mx + %mw / 2 - %cw / 2) , %py = $calc(%my + %mh / 2 - %ch / 2)
  window -dpf @CenterWindowTest %px %py %cw %ch
}

Re: Custom-Window centered to mIRC-Window [Re: Talon] #268443 07/02/21 11:54 AM
Joined: Jan 2021
Posts: 2
D
daniel61 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
D
Joined: Jan 2021
Posts: 2
@Talon

yes, thats it! thanks a lot!