mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2021
Posts: 2
D
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

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Does using -1 -1 as the x and y positions do what you wish?

Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
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
}

Joined: Jan 2021
Posts: 2
D
Bowl of petunias
OP Offline
Bowl of petunias
D
Joined: Jan 2021
Posts: 2
@Talon

yes, thats it! thanks a lot!


Link Copied to Clipboard