Jump to content
Sign in to follow this  
gcue

display: accounting for windows themes

Recommended Posts

gcue

in a msgbox, i try to center a guictrlcreatelabel by entering number coordinates and eyeballing something that looks centered.

but if the script is run under a different windows theme.. it throws it all off.. i tried looking for a way to center a guictrlcreatelabel but didnt see anything

is this possible?

Share this post


Link to post
Share on other sites
AdmiralAlkex

I don't understand, is it the control or the text you want centered?

If control use some math to calculate the center.

If text then use BitOR($SS_CENTER, $SS_CENTERIMAGE) as the style.

Share this post


Link to post
Share on other sites
gcue

i want to center text.

i tried using ss_center but that centers in the cell not the msgbox

Edited by gcue

Share this post


Link to post
Share on other sites
AdmiralAlkex

i want to center text.

i tried using ss_center but that centers in the cell not the msgbox

If you put the control in the middle and then use BitOR($SS_CENTER, $SS_CENTERIMAGE) then the text will be in the middle! So if msgbox is 100 pixels wide then create a label that is the same width and the text will be in the middle!

$SS_CENTERIMAGE = horizontal center

$SS_CENTER = vertical center

Share this post


Link to post
Share on other sites
gcue

what do you mean by BITOR ?

can you show me an example?

thanks

Share this post


Link to post
Share on other sites
Andreik

what do you mean by BITOR ?

can you show me an example?

thanks

BitOR in this case is to combine styles. For example:
GUICreate("EXAMPLE",400,400,-1,-1,BitOR(0x00100000,0x00200000,0x00080000))
GUISetState()

While 1
    If GUIGetMsg() = -3 Then Exit
    Sleep(15)
WEnd

First parameter of BitOR is $WS_HSCROLL, next is $WS_VSCROLL and last is $WS_SYSMENU.

Now I create a GUI with this styles. ;)

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites
AdmiralAlkex

what do you mean by BITOR ?

can you show me an example?

thanks

I haven't sleept for very long so this maybe not makes any sence but I believe I meant something like:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

GUICreate("Sample gui", 320, 240, 0, 0)
GUICtrlCreateLabel("This text is in the middle", 0, 0, 320, 240, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

GUICreate("Sample gui2", 320, 240, 0, 0)
GUICtrlCreateLabel("This text is also in the middle", 80, 60, 160, 120, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUISetState()

Do
    Sleep(10)
Until GUIGetMsg() = $GUI_EVENT_CLOSE

As you see the text is in the middle of the controls which are in the middle of the gui ;)

Share this post


Link to post
Share on other sites
gcue

got it!!

thank you for your quick response.

Share this post


Link to post
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
Sign in to follow this  

×