Starfinder Playlist
Page 1 of 4 123 ... Last
  1. #1

    Trying to fill only PART of a frame with a background color.

    I can fill a WHOLE frame with a backcolor value, but I'm looking to fill only a name label with a color, and later add a stringfield control next to it, and I can't get it to display the color. Does backcolor only apply directly to frames, so that I have to make a new framedef? I'm trying to avoid making a bitmap image just for a single color.

    Code:
    	<template name="frame_char">
    		<genericcontrol>
    			<!-- <frame name="groupbox" /> -->
    			<frame name="charsheetbox" />
    		</genericcontrol>
    	</template>
    	
    	<!-- This is a new template for single-line string entries. -->
    	<template name="kult_string_entry_singleline">
    		<frame_char>
    			<genericcontrol>
    				<!-- <anchored to="kult_string_entry_singleline" position="insidetopleft" offset="0,0" height="5" /> -->
    				<!-- <bounds>0,0,-1,-1</bounds> -->
    				<backcolor>#999999</backcolor> <!-- This color doesn't show up. -->
    			</genericcontrol>
    			<!-- <backcolor>#999999</backcolor> --><!-- This line works, but it's for the entire frame. -->
    		</frame_char>
    	</template>

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Add a frame to the window control. See the frame definition in the Wiki developer guide here: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp

    See various examples in the CoreRPG templates. You don’t have to have a new bitmap image, just use one of the existing frame definitions.

    Or try it with a control that has definite dimensions.

    And, if you’re using a string field control then use that, not a genericcontrol.
    Last edited by Trenloe; December 28th, 2019 at 06:51.
    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!

  3. #3
    The stringfield control isn't even implemented yet. This code is supposed to be for the gray label to the left of it:
    _________________________________
    ||||||LABEL|||||| String content |
    """"""""""""""""""""""""""""""""""""""""""""""

    I tried to follow your directions - at least what I imagined them to be - and the colors still aren't showing up.

    I don't know what you mean by "definite dimensions". I tried putting in "bounds", "width" and "height" a little here and there, with values ranging from matching the absolute position on the page, to the position within the frame, but nothing is showing up.

    Code:
    	<template name="kult_string_entry_singleline">
    		<frame_char>
    			<genericcontrol>
    				<frame name="charsheetbox">
    					<bounds>0,0,30,10</bounds>
    					<backcolor>#999999</backcolor>
    				</frame>
    			</genericcontrol>
    			<!-- <backcolor>#333333</backcolor> --><!-- This line works. -->
    		</frame_char>
    	</template>

  4. #4
    The backcolor tag is separate from frame tag. The background color will be drawn first, and then the frame drawn on top, then the contents of the control.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    The backcolor tag is separate from frame tag. The background color will be drawn first, and then the frame drawn on top, then the contents of the control.

    Regards,
    JPG
    So how do I draw a frame bitmap, and then, within that bitmap, on top of it, draw a smaller box filled with a single color? Are ALL background colors drawn first, before ALL the bitmaps, regardless of where they are? Do I have to make a png image just to fill a box with a single color?

  6. #6
    You have to layer controls to do something like that.

    Regards,
    JPG

  7. #7
    Quote Originally Posted by Moon Wizard View Post
    You have to layer controls to do something like that.

    Regards,
    JPG
    Yes, I'm trying to layer the controls. Aren't I doing that in the code I posted? I tried nesting some more controls in, but it displayed nothing but the original charsheetbox bitmap:

    Code:
    	<template name="frame_char">
    		<genericcontrol>
    			<!-- <frame name="groupbox" /> -->
    			<frame name="charsheetbox" />
    		</genericcontrol>
    	</template>
    	
    	<!-- This is a new template for single-line string entries. -->
    	<template name="kult_string_entry_singleline">
    		<frame_char>
    			<genericcontrol>
    				<bounds>59,68,-244,15</bounds>
    				<frame name="groupbox">
    					<genericcontrol>
    						<bounds>59,68,-254,15</bounds>
    						<frame name="groupbox">
    							<bounds>0,0,30,10</bounds>
    							<backcolor>#999999</backcolor>
    						</frame>
    					</genericcontrol>
    				</frame>
    			</genericcontrol>
    			<!-- <backcolor>#333333</backcolor> --><!-- This line works. -->
    		</frame_char>
    	</template>
    I don't even know what the bounds should be set to, or how "definite dimensions" even work.

  8. #8
    Control definitions can't be nested. Each control must be defined separately. By layering, I mean that the controls are defined in a way such that they overlay the same layout space in the window class definition. In that way, the control defined first will be drawn first (i.e. on the bottom), the control defined next will be drawn on top of that one, and so on.

    Regards,
    JPG

  9. #9
    Quote Originally Posted by Moon Wizard View Post
    Control definitions can't be nested. Each control must be defined separately. By layering, I mean that the controls are defined in a way such that they overlay the same layout space in the window class definition. In that way, the control defined first will be drawn first (i.e. on the bottom), the control defined next will be drawn on top of that one, and so on.

    Regards,
    JPG
    Oh, so templates cannot define more than one control?
    ...despite "addTextWidget()" being able to add and position text to a template?
    ...and so all the anchoring needs to be done outside templates?
    I got anchoring outside templates to work, but figured that it was so much repetitive code to write.

  10. #10
    No, that can't be true, because there's createControl(). Can't you nest controls with that, just like with addWidget()?

    It would be neat if I could just have a single template, that created a frame, and then resolved a label and a stringfield from two arguments (using code, I guess). This is, of course, provided that you can create a control at init-time, that would be as long as the label within it, and would allow the stringfield to be posted just after it. This seems to be doable with things like this:
    Code:
    	local w,h = labelwidget.getSize();
    	labelwidget.setPosition("bottomleft", w/2, h/2-4);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in