![]() |
Tradeskill window
<Button IsDefaultButton="true" Location="312,520" MinimumSize="10,10" Name="Repeat" PackLocation="right,bottom" ScrollExtent="42,42" Size="42,42" Style="Styles.Repeat.style" Visible="false" />
<Button IsCancelButton="true" Location="312,520" MinimumSize="10,10" Name="Stop" PackLocation="right,bottom" ScrollExtent="42,42" Size="42,42" Style="Styles.Stop.style" /> Would changing the red above to be the following move the repeat button to the center instead of being right over the stop button?: <Button IsDefaultButton="true" Location="???,520" MinimumSize="10,10" Name="Repeat" PackLocation="center,bottom" ScrollExtent="42,42" Size="42,42" Style="Styles.Repeat.style" Visible="false" /> |
Pack locations refer to how an control will move its own location in relation to it's parent's bounds. Though I cannot say that I understand what "right,bottom" would mean because that doesn't follow the format the UI builder documentation specifies. It leaves out information and uses different keywords.
If you wanted a button to remain centered near the bottom within a resizable window, you could use "CPC,FFF". I think. This is sort of going off of memory of how it works. It stands for this:
|
Quote:
|
Well, I'll just then say that I don't like the new available keywords because it doesn't give you the ability to specify all of the options. So my advice stands. :p
What would "right,bottom" even mean? Is it "FFF,FFF" or is it "NFF,NFF"? If the PackSize is "F,F", it doesn't matter. But if you use any combination of A or P instead of F, it will change the behavior. I simply don't like shortcut keywords(that aren't even shorter) that create ambiguity. But whatever... to some people that don't want to learn what the shorthand letters mean, I guess learning the full words may be okay. |
right, bottom is FFF,FFF if I remember correctly. I have used both in my code in the past, even in combination (e.g. cfc,bottom is valid).
Having options for convenience is never bad. While I can code assembler I prefer to use high level programming languages for the same reason. :) |
Quote:
I used to like foreach in programming because it allowed me to skip specifying the conditions of exiting and incrementing a number in a for loop. Then I found out that in most of the cases that I used it, it caused my program to be slower. So I stopped using it completely because it would never be faster and usually slower if I was careful as to how I coded the rest of the loop. So to sum up this analogy, easier is not always better. PS, I wonder what the OP thinks of how this conversation is turning out. PPS, I wish that .NET Forms programming actually had this level of detail. Specifically proportional resizing and relocation. Using table containers are just cumbersome. |
You could have made the same argument my assembler analogy already and I actually expected you to do so. ;) And depending on the type of array you are looping through foreach can actually be faster.
And to actually say something relevant to the OP: If you use UIbuilder there are buttons on the preview panel to align UI elements. Although I always did it mathematically by hand. And maybe to clarify what Aditu has explained: PackLocation is only relevant when you resize the window in game to a different size than what it says in the XML. It is used to adjust the location of elements with respect to other elements. The complementary attribute is PackSize which does the same for the size. |
lol
you guys lost me at pack locations lol I think I get it though... I think? Basically this code is out dated and should be cpc instead of right,bottom? right?
I'm a serious noob but I'm tryin to learn. Thanks for the replies, James |
It's not outdated, the other one is just more precise. The important part was however that you need to change "Location".
|
is this right?
what would I change location to? would it be half of 312? Meaning
Location="156,520"? |
I can't tell just like that since I got no reference to calculate the center of your window from. Just try it and see how it looks.
|
Quote:
Essentially what you want to center something is: (ParentWidth / 2) - (ChildWidth / 2) (354 / 2) - (42 / 2) (177) - (21) 156 Oddly the result is the same as you guessed at. Though I have a feeling your button isn't pressed all the way against the edge of the window. So you'll need to plug in the real numbers. |
LMAO
Dumb luck perhaps but I do understand what you are saying here to get the true center. thank you for the responses. A word on the UI Builder, I would like to learn how to use that thing but I just don't get it. and understand the controls or how to make the preview look like it will in game or how to add anything to it. I suppose I could read the faq on it or the instructions and perhaps the comic while I'm at it. At least with my notepad full of code I am able to pick it apart and at least find what it is I am looking for. Now if I could only learn what to to with it once I find it I might make an ok modder. :D |
Quote:
All the parts of the window are child objects of the window object (use the little + to expand). The box at the bottom of the left window is all the properties of that object -- be it a window, a piece of text, etc. |
| All times are GMT -5. The time now is 05:34 PM. |
vBulletin® - Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
© MMOUI