I'm having a few problems laying out my phone page which contains a Hub control. The height of the Hub control doesn't seem to be consistent with it's parent container.
To see the issue for yourselves follow the steps below:
Create a new project.
Choose Store Apps - Hub App (Universal Template).
Goto the Windows 8.1 part of the project and view the HubPage.xaml unit.
Place the cursor in the Grid element on line 35 and view it's layout properties in the property window.
Notice that it's VerticalAlignment is set to stretch and it's height is set to Auto (768).
Now do the same with the Hub element on line 41 and it's height is also set to Auto (768) as you would expect.
Now go to the HubPage.xaml unit in the Windows Phone 8.1 part of the project.
Place the cursor in the Grid element on line 73 and view it's layout properties in the property window.
Notice that it's VerticalAlignment is set to stretch and it's height is set to Auto (640).
Now go to the Hub element on the next line (74) and although it's VerticalAlignment is set to Stretch, it's height is set to Auto (666.666625976562).
How can the Hub element be bigger than it's parent when everything is stretched vertically. What's worse is that the difference between the height of the child and the height of the parent seems to change when the phone switches to landscape mode. This is really causing me issues with my app layout and I'm struggling to understand why it is happening.
Can anyone explain this?
Related
I am trying to show a diagram of products with the image to scale. I have the image element sized with a width and min-width set to the correct width for the image.
I have an 'resize' event listener triggering my zoom on the image element to equal a correction factor:
const ratio = (window.innerWidth / window.outerWidth)
This works acceptably except when the browser vertical sidebar is open.
I searched here and could not find a property to show me sidebar width or to accurately detect zoom level in all browsers. I can use window.devicePixelRatio but that is not working in mac safari.
Would a canvas or svg element offer me some opportunities here i don't see?
Perhaps the best is just to have a input type='range' element next to the image to allow calibration to common object such as a credit card or coin.
Am I mistaken in thinking that if my picture is correct at 600px on my machine that it can be rendered universally in the browser with css width settings?
Thanks alot for any reflections
I have a simple bitmap image 3px wide and 150px high included as the top banner in my layout.
<s:BitmapImage id="blueBanner" source="{this.bmpimg}" width="100%"/>
The rest of the content is centered below this.
When the page opens no matter the size of the browser window, the image always fills the width available.
I have a browser window resize handler that resets my main content below the banner to the center of the new window size and this works perfectly.
But no matter how many times the browser is resized, the BitmapImage will never stretch wider than the original window width.
I have tried every property and method of BitmapImage that I think could affect this in the resize handler but nothing I can find has any effect at all.
I cannot understand how it remembers the original stage width to begin with.
Its parent containers are all set to 100% width and there are no unusual skins or any other reference to this object in the whole project except in a function where it can be included in the layout or not, but this function is never called in this case.
Can anyone offer any clue as to why it won't stretch automatically?
Doug
Simple , just set the width to screen.width and you are good to go.
<s:BitmapImage id="blueBanner" source="{this.bmpimg}" width="{screen.width}"/>
Thanks for all the responses. In fact I solved the problem by adding the BitmapImage line to the Application Skin. Once it's here as well as in the layout it works. I have no idea why it needs to be in both places, but once it's set up like this everything works correctly.
Setting ScaleMode makes no difference and setting screen.width either in the blueBanner tag or later in the resizeHandler (because not always available when the tag is run) also makes no difference in my layout.
Doug
I'm writing a script to output things to a window comprising a Tkhtml widget and a text widget displayed above each other in a ttk::panedwindow. Both widgets are scrollable both vertically and horizontally. There's also a button allowing the user to clear the text widget.
I'm doing some of the development on a laptop running Ubuntu. The window manager allows for four desktop workspaces in a 2x2 array, and when the GUI is first displayed, the bottom fifth or so bleeds from the workspace I'm using into the one below. It's irritating to have to muck around resizing the window to make it short enough to fit onto the screen so I want to resize it.
(I think) I know approximately how to do this, i.e bind to an appropriate event so that I can run a script when the window is first displayed. (Reset the binding from within the script so that it only fires once.) I believed that the "appropriate event" was <Map>, but when the window was first mapped, the two widgets had zero height (as reported by [winfo height]). I tried binding to <Expose> and this seems to work, ([winfo height] returns sensible numbers,) so:
Question 1: Which event should I bind to?
When the binding fires, [wm geometry] reports the geometry as 815x1029+49+24, [winfo height] reports the two heights of the two widgets as 600 and 366, and [wm screenheight] returns a height of 800. I know there are various other bits and pieces in the GUI so I'm not surprised that there are 63 pixels unaccounted for in the initial layout. I assume that I need the same amount of space after resizing, so I should request a geometry of 815x737+49+24, but when I do, a sliver (approximately the lower horizontal scrollbar) still bleeds onto the next workspace.
By mucking around manually, I know that when everything fits nicely onto the screen the geometry should be 815x717+49+24, so I've added a fudge factor of 20 to the amount of space I allow for the "other bits and pieces of the GUI". This works fine but seems a little inelegant (massive British understatement :-) ), so:
Question 2: What have I missed, requiring use of a fudge factor?
I'm using Tk 8.6.1 on Ubuntu 12.04.5 LTS. I'm using version 0.9.7.12 of the Compiz window manager.
Update
It struck me that I ought to find the height of the various panes, rather than the Tkhtml and text widgets as that would account for the scrollbars and the "Clear" button. The pane heights are 615 and 409 initially, but this just means that I have to increase my fudge factor from 20 to 78 to get the request height to my desired value of 717. Is there any way to predict what height to request for the toplevel containing my paned window in order to get that toplevel to fill the screen?
I recommend binding to <Map>. I would wait for all of: the paned window, the main tkhtml window, the text window and the scrollbars to be mapped before trying to adjust heights.
For Linux, the [winfo screenheight .] does not know about any panels that are configured, so you have to subtract those. You can get the actual screenheight available by creating a window, doing a wm attributes . -zoomed 1, then getting the geometry of the window.
The title bar and borders of the window take up space. The space needed for these can be calculated by comparing the output from [winfo geometry .] and [wm geometry .].
There is also the panedwindow sash height and any margins and padding.
You can calculate the total of these by subtracting the panedwindow heights from [winfo height .].
Here is one method that would always work, however, it is not very attractive, as the user would see the windows flashing as they change size.
Maximize the window (wm attributes . -zoomed 1)
Get the window geometry and parse out the screenheight.
De-maximize the window (wm attributes . -zoomed 0)
Get the window geometry and replace the screenheight
with the maximized screenheight.
Set the window geometry.
I'm trying to use zingchart to create responsive charts, but the chart does not get sized correctly upon the initial rendering. If you resize the window, it does get sized properly though.
Steps to recreate it:
download the file from here.
Change lines 148 and 149 with:
height: "100%",
width: "100%"
Open a new browser window (tried it on latest chrome, windows), resize it to a width of 450 or less pixels.
Open the edited file in that window.
The chart will have a width of 640px, even though its parent div will be sized properly.
I've tried of course, to set the div's size manually, or to 100% width, and the html and body's width to 100%.
Am I doing something wrong, or is it the library's fault?
In order for the chart to size properly, the div containing the id, must have both height and width to 100%. If either is missing (I was ommiting height), it doesn't get sized properly.
In the specification config.xml of a wirecloud widget, we can set initial width and height
<Platform.Rendering width="x" height="y"/>
When I put in something like width 300 and height = 80, the widget gets much bigger and overflows the screen.
In the specification I only see that the width field defines the width.
http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/FIWARE.OpenSpecification.Apps.ApplicationMashup
I see in example widgets values like 5 and 8. So what unit is the width and height?
WireCloud prior to 0.8.0 only supports columns and row as units. Pixels and percentages are supported from WireCloud 0.8.0 onwards.
See the documentation for more info.
If you check your workspace settings, you will see that you may set your workspace grid up by determining the number of columns and rows you want it to use.
I think these numbers refer to the workspace grid columns/rows.