Jump to content

How to center this?

Go to solution Solved by minibois,

x and y?

As for x:

TextField.x =(WholeFieldWidth / 2) - (TextFieldWidth / 2)

y is the same, but with .y and height obviously.

 

(Not sure what language though and what kind of variables it has)

Okay, if my label is like 150 pixel large and my frame (the thing I want to center it in) is 770 pixel wide. I like, can't figure out the formula or whatever, I feel stupid right now, help.

Link to comment
Share on other sites

Link to post
Share on other sites

x and y?

As for x:

TextField.x =(WholeFieldWidth / 2) - (TextFieldWidth / 2)

y is the same, but with .y and height obviously.

 

(Not sure what language though and what kind of variables it has)

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

x and y?

As for x:

TextField.x =(WholeFieldWidth / 2) - (TextFieldWidth / 2)

y is the same, but with .y and height obviously.

 

(Not sure what language though and what kind of variables it has)

 

No but I don't mean in a programation language. I mean in general, how woud you sort it out?

Link to comment
Share on other sites

Link to post
Share on other sites

How do you expect people to help you if you aren't more specific as you are right now?

Link to comment
Share on other sites

Link to post
Share on other sites

How do you expect people to help you if you aren't more specific as you are right now?

 

Well he helped me out and I was not specefic. And I kinda did, I said in pixels. Not in programmation, just in general, doing it with your head. I know it's sutpid but I couldn't figure it out.

Link to comment
Share on other sites

Link to post
Share on other sites

770 - 150 = 620

620 / 2 = 310

 

space left 310px

space right 310px

Intel i7 6700k - MSI Z17A0 Gaming M5 - 4 x 8Gb Kingston HyperX 2666Mhz - MSI GTX 970 - Samsung Pro 128Gb - WD 3Tb - 750 Watt MS-TECH

Link to comment
Share on other sites

Link to post
Share on other sites

No but I don't mean in a programation language. I mean in general, how woud you sort it out?

Well, kind of like I did still.

Take the half of the width of where you want to place it, take half of the width of the thing you want to place somewhere and subtract that last number, with the first one and you will know where to position the middle of the object on the platform.

 

Are is this still too much like programming? '-'

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

Well, kind of like I did still.

Take the half of the width of where you want to place it, take half of the width of the thing you want to place somewhere and subtract that last number, with the first one and you will know where to position the middle of the object on the platform.

 

Are is this still too much like programming? '-'

 

It's fine, I was just precising that it wasn't for a language because you said "(Not sure what language though and what kind of variables it has)". I already picked your answer.

Link to comment
Share on other sites

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

×