Thread: Anchor takin' me down...
-
April 16th, 2018, 15:05 #11
It's good practice to anchor controls and labels within a frame. Then you can easily move the frame around and the controls automatically move with the frame. It is not good practice to use purely static anchoring for standard controls - unless they are at the very top level.
Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 16th, 2018, 16:47 #12
Damned/Trenloe - I got that it was best to use anchoring versus having literal X,Y positions. Note sure if that is what you mean or if I am still using what you call "static anchoring" unintentionally. Below you will see the (snippet of start/end) of the Attribute Bonus section.
I am not trying to give exact location on Window - I wanted to give OFFSET to window edge (see initial post "code" section) - As you can see below, I use the anchoring method. I still have to try/learn the "RELATIVE" option (reminded of that in Damned's damn fine video) to use that when appropriate/better.
Code:... <!-- Column One --> <!-- Bonus to Hit --> <number_bonusfield_base name="strength_bonustohit" source="abilities.strength.bonustohit_melee"> <anchored> <top parent="strength" anchor="top" /> <right parent="attributebonusframe" anchor="center" offset="-10" /> </anchored> <!-- <description textres="TEXT-TO-DISPLAY-WHILE-DRAGGING" /> --> </number_bonusfield_base> <label_charattributebonus name="strength_bonustohit_label"> <anchored to="strength_bonustohit" /> <static textres="char_label_attribute_bonuses_bonus_to_hit" /> <tooltip textres="char_label_attribute_bonuses_bonus_to_hit_description" /> </label_charattributebonus> <!-- Open Doors --> <number_bonusfield name="strength_opendoors" source="abilities.strength.opendoors"> <anchored to="strength_bonustohit" /> <rollable /> </number_bonusfield> <label_charattributebonus name="strength_opendoors_label"> <anchored to="strength_opendoors" /> <static textres="char_label_attribute_bonuses_open_doors" /> <tooltip textres="char_label_attribute_bonuses_open_doors_description" /> </label_charattributebonus> ... <!-- Column Two --> <!-- Armor Class Bonus --> <number_bonusfield name="dexterity_armorbonus" source="abilities.dexterity.armorbonus"> <anchored to="attributebonusframe" position="insidetopright" offset="20"> <top parent="strength_bonustohit" anchor="top" /> </anchored> </number_bonusfield> <label_charattributebonus name="dexterity_armorbonus_label"> <anchored to="dexterity_armorbonus" /> <static textres="char_label_attribute_bonuses_armor_bonus" /> <tooltip textres="char_label_attribute_bonuses_armor_bonus_description" /> </label_charattributebonus> <!-- Hitpoint Bonus --> <number_bonusfield name="constitution_hitpointbonus" source="abilities.constitution.hitpointbonus"> <anchored to="dexterity_armorbonus" /> </number_bonusfield> <label_charattributebonus name="constitution_hitpointbonus_label"> <anchored to="constitution_hitpointbonus" /> <static textres="char_label_attribute_bonuses_hitpoint_bonus" /> <tooltip textres="char_label_attribute_bonuses_hitpoint_bonus_description" /> </label_charattributebonus> ...
OK - so I tried (on laptop at work....muhahaha) to do what I thought would work - even though still wanted to know why other doesn't... and IT didn't work so I have messed something else up that I haven't gotten so... guess back to drawing board...
I don't get it...
Code:<frame_char name="classlevelframe"> <anchored to="contentanchor" position="insidetop" offset="0,10" height="55"/> </frame_char> <stringcontrol_charclasslevel name="classlevel"> <anchored to="classlevelframe" position="insidetopleft" offset="15,12" width="255" height="20" /> </stringcontrol_charclasslevel> <labelbelow name="class_level_label"> <anchored to="classlevel" /> <center /> <static textres="char_classes_and_level_title" /> </labelbelow> <detailsbutton_charclasslevel name="detailbutton_classlevel"> <anchored to="classlevel" position="righthigh" offset="0,0" /> </detailsbutton_charclasslevel> <stringu name="race"> <anchored to="classlevel" position="right" offset="40,0"> <right parent="classlevelframe" anchor="right" offset="-15" /> </anchored> </stringu> <labelbelow name="race_label"> <anchored to="race" /> <center /> <static textres="char_label_race" /> </labelbelow> <linkifnotemptyfield> <description field="race" /> </linkifnotemptyfield> ... <!-- Saving Throws --> <label name="savingthrow_label"> <anchored to="classlevelframe" position="belowright" offset="0,10" height="25" /> <multilinespacing>12</multilinespacing> <static textres="char_label_savingthrows" /> </label>
See result of using above now (no longer offsetting from parent window, using same style I always use instead):
hmm-off-to-left-still.jpeg
After uploading pick, I went - hmm maybe I AM flipping out and set it to opposite of what I thought, "belowleft" and it isn't what I want BUT it appears where I'd EXPECT it to appear, indented from left edge of frame and down a bit... why doesn't it do same from right?
Sorry for so much included code - I DID try to limit it to a few lines at first posts but I think I was being misunderstood on what I wanted to do. Also... I'm still a bit embarrassed at layout - learning this stuff and xml code will probably be more best-practice-y as I continue with this (I always go back to refactor as I work)Last edited by Varsuuk; April 16th, 2018 at 16:51. Reason: Removed tabs to better fit
-
April 16th, 2018, 16:58 #13
WOAH ... OK - writing these posts usually lead me to think to try something or realize something because it forces me to write the issue history and assumptions plus what I've tried. So, I stared at "label", nothing about that should have hidden data since it's low level not a template.
So what else..
Multiline... OK, well, that's a complication - let me remove that so I can rule it out, it works fine elsewhere but still... start small work up...
Removed multiline:
Attachment 23055
So, I still do not know the issue and how to get my multiline setup (sure, can put 2 labels if all else fails) but NOW I have a clue where I didn't before posting these things
Will now definitely work on it at lunch and ummm... get back to our replatforming project here at work /sheepishgrin
PS: I was just trying to get placement alignment - once that was done was going to resize the window (and because I did all via anchors EVERYTHING moves correctly with it when I do it hehehe - love that) but didn't at time of the screenshot yet.
-
April 16th, 2018, 17:17 #14
It is a template. It isn't a base FG control - it's not documented in the API reference. Search for template name="label" Like I've said before - don't assume! ;-)
Glad you got it working. You said in your first post you were going to remove multilinespacing - why didn't you?!? ;-)
Let's see in JPG has any ideas why that would make a difference to the anchoring behaviour...Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
April 16th, 2018, 19:51 #15
Yeah, I knew it wasn’t a base control since I searched and found it and came up with my own variation of the label template which I ended up not using. But I forgot and mule-umed
But yeah... about the multi line... blast, I DID forget to remove it to just do a sanity check.
No good excuse but yeah, I have so little free time I do all this coding at 1-3am or on commute or while listening to Pluralsight Java classes at work hehheh
Couple that with my bad memory/ADHD and I am go off too soon when sleeping on it would be better. I apologize for that. Hopefully soon I get to pay it forward
-
April 17th, 2018, 02:34 #16
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
So...I sort of scanned through this thread, but there's a lot to digest, and it's unclear to me what's being asked.
If you are still looking for information, can I get some help distilling to a specific question I can answer? Something short and sweet?
Thanks,
JPG
-
April 17th, 2018, 03:03 #17
-
April 17th, 2018, 03:09 #18
Putting <multiline>#</multiline> within a <label> ... </label> pair makes it go wonky when anchoring To right edge of window regardless which of two methods used (position or anchor)
*drops mic*
-
April 17th, 2018, 03:16 #19
*** MOON READ PREVIOUS POST - it should be enough ***
I couldn’t resist Damned, my friend - but you are TOO RIGHT (again, I AM diagnosed with ADHD and have quite the hyperactive mind...ok...mouth)
Moon my initial example shows one of the two ways it goes wrong. Check out JUST the code section and attached pictures, forget the post itself the code and pic tell a 1024 words...
It seems to be he <multiline> which I’ve used elsewhere fine (will not explain to keep short)
I used multi to label stuff below a number box like:
Armor
Class
I played with multiline value, settled on 12 when control was 25 high because “looked right” not because fully got that rag.
But really, the short post is enough no need to read this.
Regards,
Varsuuk
“There are 10 kinda of people in the world, those that understand binary and those who don’t”
*** MOON READ PREVIOUS POST - it should be enough ***Last edited by Varsuuk; April 17th, 2018 at 03:19.
-
April 17th, 2018, 22:39 #20
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
I think that the issue is that "right anchor" is being confused with "right aligned". Fantasy Grounds doesn't support right aligned text fields, only left aligned and center aligned.
You can "fake" right alignment for single-line text fields by using a right anchor with no left anchor. However, as soon as you add a left anchor or width (which is needed to do multiline), you can't fake that anymore. If you really want to do multiline right-aligned labels, you'll need to set up each line as its own string label.
Regards,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks