Jump to content

Input vertically center


Recommended Posts

Hello guys

As title, i want to create an inputbox without any border ( or a colored one of the same background color )

This is what i have:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>

$Form1 = GUICreate("Form1", 287, 228, 228, 159)
$Input1 = GUICtrlCreateInput("Input1", 8, 16, 121, 21, -1, 0)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFFF)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

The problem is the text is not vertically centered, maybe i'm using the wrong style.

Some help?

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>

$Form1 = GUICreate("Form1", 287, 228, 228, 159)
$Input1 = GUICtrlCreateInput("Input1", 8, 16, 121, 21, $ES_CENTER, BitOr($WS_EX_WINDOWEDGE, $WS_EX_CLIENTEDGE))
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetColor(-1, 0xFFFFFFF)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

No, i have write:

v

e

r

t

i

c

a

l

l

y

centered and not horizontal, badly there is not $ES_CENTER for vertical. 

Yes your input is vertically centered ( like the normal one ) but have the border and i'd like it borderless or the border of the same color of the background ;)

Removing the border cause the "issue"

$Input1 = GUICtrlCreateInput("Input1", 8, 16, 121, 21, Default, $WS_EX_TRANSPARENT)
Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

Something like that: ??

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

I didn''t see that :sweating:

Just a question. It create a new GUI for the control and return the $nInput, if i what to hide the input after the creation GuiCtrlSetState(-1 $GUI_HIDE) seems not working

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

Use this for example:

WinSetState(_WinAPI_GetParent(GUICtrlGetHandle($Input2)), "", @SW_HIDE)
WinSetState(_WinAPI_GetParent(GUICtrlGetHandle($Input2)), "", @SW_SHOW)

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

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...