I have a web page that uses em units to allow it to size automatically to any screen size, so the page displays fairly well on mobile devices. I notice, though, that the iPad and iPhone (those are the only mobile devices I've checked so far) wrap blocks of text wherever they feel like it and this breaks the formatting if I've inserted spaces to line up lines. For example, I might have the text
1. This is the first sentence of some text
that wraps to a second line.
There's a Return at the end of "text." on the first line and then the next line has spaces at the beginning to get "that" to line up under "This." But now if an iPad decides to wrap this text after "some" the formatting is destroyed:
1. This is the first line of some
text that wraps to a second line.
Is there a way to tell mobile browsers to not wrap the text themselves and just honor the Returns in the text?
Thanks
Have you tried wrapping your text in <pre> tags ? it will respect your formatting.
Anyway, having the text reflow is preferable since it can rearrange and adapt to any screen size, there is nothing more annoying than having to scroll to the end of the lines to read the text.
If you want to have greater control of text output you will have to address each screen size individually, so I’d use the media element in CSS so you can apply different style depending on screen size.
google “screen size in css responsive” an you will see lots of resource about it.
Looking at your example text more closely, cold you enter <li> tags? so that the numbering could be placed outside? using list-style in CSS? I mean, if your problem is only with list numberings, maybe that can do it.
Best regards.
Related
We need to use the built-in WinForms tooltip control to display a very long tooltip (about 4000 characters) for one of our controls. But if we do so, the form freezes for a minute or two when we place the mouse pointer into the target control to see the tip. And nothing happens after that.
We experimented and detected that the standard tooltip starts to work very slow when it has about 2000 chars, and the situation becomes much worse when we increase the number of chars. Is it a known issue, and is there any workaround for it? Please, don't suggest to trim the tip text - we need to display the string as is.
When you assign a string of text to a ToolTip, part of the process of drawing it involves calls to USP10.dll which handles Unicode layout of characters on screen. I was able to see this by looking at the stack trace while the program was freezing. The performance of this layout is terrible for long strings.
Disabling Visual Styles for the application (commenting out EnableVisualStyles()) fixed the problem - the tooltip displays immediately, though this is not an optimal solution.
I kept looking and found this page which indicates the problem may be linked to layout of long strings where word-wrap is necessary. By inserting line breaks into the tooltip text, I found that the string displayed immediately. So, if you can determine where to insert the line breaks manually, the ToolTip should display quickly.
What about using another Tooltip , i.e. HtmlToolip?
I have a very simple form with a RichTextBox field. It is acting as a crude log file viewer. As log data is added to the file I append the new data to the text box. This works great but I wanted to prevent the text box from scrolling when the new data was appended so the currently visible data could be read. I experimented with this for a while and I ultimately had to call the native SendEvent function to get and set the scroll position before and after appending the text. This has also been working great, however, I now have a new problem: over time the log file can grow quite large and use huge amounts of memory to keep the entire contents of the log file in the text box. So now what I've done is limited the amount of text in the text box by removing text from the beginning if the text size reaches a certain threshold.
So now my problem is that I can maintain the scroll position, but the text will change since I am removing text from the beginning. Is there a simple way to change the scroll position to maintain readability (obviously if the user is reading the first line of the text box and that is removed then there is nothing that can be done, but I think that is acceptable)?
Here's an example: say my threshold is 1MB of text in the text box. If there is currently 1MB of text, and I need to append 1000 characters then I also need to remove 1000 characters from the beginning. If I am scrolled to the middle of the text then I can maintain that scroll position after the removal and appending of text but now the text that I was reading is further up.
Maybe I need to rethink my approach?
I realized that modifying the text while the user is viewing it doesn't really make sense. So I decided to add an option to this form to 'freeze' updates to the text box. When frozen no text will be appended or removed and the user can freely scroll around. When unfrozen all of the appending/removing works as normal.
I have a silverlight application which consists of a few tabs, which I would like to print or to generate PDF containing these tabs.
I tried to use StackPanel to add each tab and then use PrintDocument to print what I see, but there is a problem because there are too many tabs, so they don't fit in the size of A4 document.
And more, when I resize the browser to a smaller size, only the visible part of the content gets printed.
Is there a different method to print all the content in one document or PDF?
The PrintPageEventArgs in the PrintPage handler contains the size of the paper so you can calculate how much can be printed on a single page.
Printing (a part of) the visual tree has its disadvantages; what looks good on screen might not be good for paper, especially if scrolling and sizing are involved.
A solutions is to design one or multiple Views for printing and simply bind the same ViewModel to the PrintView. A bit like the special CSS for creating a print version of a web page.
If the content doesn't fit you should use more pages.
This article by Charles Petzold is worth reading too
this is how Chrome finds you a word when you search for it:
1) select it in all the places it appears.
2) draw little line in the scroll bar wherever it found the searched word.
I have a canvas with scroll view around it, and I want to perform the same thing on it.
I gues that for enabling the selection i'll have to use only richtextboxes ?!? (hope not).
any third party or idea or anything will be highly appreciated
Without looking directly at the Chormium Project (which is open source and available at Chormium Homepage) I would imaging what is happening on this particular example is something following these steps:
Word Highlighting
Search the page source/content for the keyword using a simple regex
Insert that text into some form of a HTML container (either a span or a div) with a particular id
Use CSS to style that container to indicated the highlighting
Sidebar Highlighting
Use some algorithmic method to vertical position of the highlighted term
Add a indicator to the side bar in a some presentation layer/control that is transparent and below the scroll bar
It may be possible that there exists a 3rd party control that does these things, or it may be possible to leverage your work off of the existing work in the chromium project. However it is most likely not done using a RichTextBoxes nor simple text selection.
I have textBlock defined such that it fills the entire screen of the phone.
The textBlock is initialized with some data which cannot be displayed in the boundary and hence gets clipped.
I want to read the data which actually got rendered on the screen (i.e. whole data - clipped data).
Putting a breakpoint shows me that myNewTextBlock.Text contains the entire data that it was initialized with.
Thanks
You could look at using Measure and MeasureOverride to determine how much of the Text would fit in the available space.
You'll likely need to test various trimmed versions of the Text but it shouldn't be too tricky.