Jump to content

Can't get InputBox with custom Height horizontally centered


Recommended Posts

Hi Guys,

I've set the vertical height of my InputBox to the screen resolution height minus the taskbar.  The height bit works great, but consequentially the window is no longer centered.  The first 0 in the InputBox parameters below is the Left property.  I can't set it to -1 nor just omit it leaving a comma as in ".. $Usable_Screen_Area[3],, 0".  Is there any easy way to get my Window centered shy of a separate program that launches just before, waits for my InputBox, an then centers it.  I would think -1 would just equate to centered, but it isn't valid input according to SciTe

;Needed to get usable screen area
#include <WinAPI.au3>

;$Usable_Screen_Area[3] = screen height minus the taskbar on the current screen which may or may not have a taskbar
Local $Usable_Screen_Area = _GetDesktopArea()
        
;The M2 means a 1-2 character value is required, $Usable_Screen_Area[3] is the screen's height minus the taskbar if there's a taskbar on the current screen
$Response = InputBox("Simulator", "Please enter the index you'd like to simulate?" & @CR & $Options, "", " M2", -1, $Usable_Screen_Area[3],0, 0)

Thanks for your help,

Christian

Christian Blackburn, A+, Network+
 

Link to comment
Share on other sites

;Needed to get usable screen area
#include <WinAPI.au3>

;$Usable_Screen_Area[3] = screen height minus the taskbar on the current screen which may or may not have a taskbar
Local $Usable_Screen_Area = _GetDesktopArea()
        
;The M2 means a 1-2 character value is required, $Usable_Screen_Area[3] is the screen's height minus the taskbar if there's a taskbar on the current screen
$Response = InputBox("Simulator", "Please enter the index you'd like to simulate?" & @CR & $Options, "", " M2", -1, $Usable_Screen_Area[3],Default, 0)

Have you tried this? I can't really test it because I don't have the desktop area part of your code.

EDIT: I tested it, seems to work.

Edited by anthonyjr2

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Link to comment
Share on other sites

This example is for one monitor.  
For an input box to appear on either of two monitors, see the example of _WinAPI_GetMonitorInfo function in AutoIt help file.

#include <WinAPISys.au3>

$Response = InputBox("Simulator", "Please enter the index you'd like to simulate?", "", " M3", _
         - 1, DllStructGetData(_WinAPI_GetMonitorInfo(1)[1], 4), Default, 0)

 

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...