How to resize Popover window? - sapui5

I have created a Popover that looks as follows:
How to set the Popover window smaller?

if you just wanna show an information to the user use an sap.m.MessageBox.
sap.m.MessageBox.information(
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat"
);
If you need sap.m.Popover go for sth. like this:
contentWidth="{= ${device>/system/phone} ? '100%' : '20%'}"
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core">
<Popover title="Popover" placement="Bottom" contentWidth="{= ${device>/system/phone} ? '100%' : '20%'}" class="sapUiContentPadding">
<Text
text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."/>
</Popover>
</core:FragmentDefinition>

Related

markdown how to anchor link special characters like ä ö ü

description
I want to link some titles in Markdown. It works good except when I link a German word like "Systemüberwachung" or "ähnliches". I think this is not working because of the "ü" and "ä".
I already tried to link like this: #system-berwachung, #systemberwachung, #systemuberwachung and many others.
But how can I link word with the characters ä ö and ü?
I use VSCode 1.63.2 and Markdown Preview
test code snippet
- [Systemüberwachung](#systemüberwachung)
- [something](#something)
- [ähnliches](#ähnliches)
## Systemüberwachung
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
## something
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
## ähnliches
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet
.
It looks like Visual Studio Code takes the title string, lower-cases it, and URL-encodes it. That makes sense, as these are essentially URL fragments.
Heading
Link fragment
Systemüberwachung
system%C3%BCberwachung
ähnliches
%C3%A4hnliches
You can reproduce this in JavaScript, e.g. like so:
encodeURIComponent("Systemüberwachung".toLowerCase())
//=> "system%C3%BCberwachung"
(There's probably more to this logic, e.g. to replace punctuation, but for the purposes of this question I think this is the relevant part.)
Unfortunately, these links don't seem to actually work, even though they are linking to the correct elements. I'm not sure why that is.
Background
Since Visual Studio Code is built on Webview, I discovered this by opening up its dev tools with the "Developer: Open Webview Developer Tools" command via the command palette.
Then I used the "select an element" feature (also available via Ctrl+Shift+C when the dev tools are open and focused):
Clicking on the rendered title brings up the underlying HTML in the devtools panel:
Which then reveals the generated ID:
<h1 data-line="0" class="code-line" id="system%C3%BCberwachung">Systemüberwachung</h1>
We can verify that we are using the correct ID in the devtools console, e.g.
document.getElementById("system%C3%BCberwachung")
# German umlaut characters
## Table of Content
- [Systemüberwachung](#systemuberwachung)
- [something](#something)
- [ähnliches](#ahnliches)
<div id="systemuberwachung">
<h2>Systemüberwachung</h2>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
## something
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
<div id="ahnliches">
<h2>ähnliches<h2>
</div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...
.

How to vertical align material ui Checkbox

Simple put, I'd like to vertical align the Checkbox from Material UI.
Try changing alignItems style property of FormControlLabel.
This worked for me:
<FormControlLabel
sx={{ alignItems: 'flex-start' }}
control={
<Checkbox
sx={{
marginTop: -1,
}}
/>
}
/>
This took me a while to track down, but this solution for another forum was the one that worked:
<FormControl fullWidth>
<FormControlLabel
style={{display:'table'}}
control={<div style={{display:'table-cell'}}><CustomizedCheckbox/></div>}
label={<div className="disclaimerandnotes">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</div>}
/>
</FormControl>
Since MUI is based on Flexbox, you can simply override its alignItems property:
<FormControlLabel
control={
<div style={{ alignSelf: 'start' }}>
<Checkbox checked={isChecked()} onChange={check.toggle} />
</div>
}
label="Toggle Checkbox"
/>
You can probably make it even leaner by overriding the checkbox component style.

UITextView height changes to scrollable after adding Line Break

I am trying to set the height of a UITextview and all works well until I try to format the text.
An example might be "/n" or using a line break with the Swift Multiline String Literals.
After that the Textview becomes scrollable with some sort of max height value.
Does formatting the text destroy the "self.overViewTxt.contentSize.height"?
Thanks.
#IBOutlet weak var overViewTxt: UITextView!
#IBOutlet weak var overviewTxtHC: NSLayoutConstraint!
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
overviewTxtHC.constant = self.overViewTxt.contentSize.height
or
overViewTxt.text = """
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\n non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
"""
UITextView has a unique property of calculating height automatically. You DON'T need to take the IBOutlet of constraint or do not give any fix HEIGHT constraint, rather than you need to disable it's scrolling property and then assign any text it will be automatically became of it's size.
Note: Make sure you give proper constraints, i.e., top, bottom, leading & trailing.
Try to update frame instead of using constraint:
overViewTxt.text = "Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, \n sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
let overviewTxtHCSize = overviewTxtHC.intrinsicContentSize
overviewTxtHC.bounds.size = overviewTxtHCSize

Replacement for deprecated SAP UI5 Control "TextView"

What is the recommended replacement for the SAP UI5 Control "TextView", which is deprecated since 1.38?
I found this outdated Control while working through the SAPUI5 Walkthrough tutorial and following a "related information" link that is still using on the old TextView Control.
There is no replacement info given in the API Reference of TextView:
https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.commons.TextView
You can use sap.m.Text instead. Api.
View example:
<mvc:View
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<VBox class="sapUiSmallMargin">
<Text text="Lorem ipsum dolor st amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat" />
</VBox>
</mvc:View>

Is it possible to crop an Element using Elm's std library? If not, is there a 3rd party lib for this?

I often run across a situation where I've constructed an Element or Form and wish to crop the view down to a given area (i.e. for scrolling within a smaller rectangle) though I haven't been able to find any methods for this within their respective modules.
Is it possible to do this using Elm's std library? If not, are there any 3rd-party libraries capable of doing this?
Otherwise, perhaps there is a better way of achieving this?
Any help or suggestions appreciated!
No scollbars (using the std library)
I can't find a way to crop but have scrollbars with the current Graphics.Element. What is possible is to crop without having scrollbars, either through a container that's smaller than it's contents or by resizing an element with size. I think the container way is more robust, as resizing an image will actually warp the image.
Here's an example:
import Graphics.Element exposing (..)
import Text
string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est."
main : Element
main =
let element =
leftAligned (Text.fromString string)
|> container 400 300 topLeft
in container 205 200 topLeft element
Scrollbars (via "3rd party" library)
If you want scrollbars, you'll probably need at least a little bit of html from elm-html. Note that the author of the library is also the author of Elm, so it's not quite 3rd party :P . You can keep it minimal by using conversions to html and from html and wrapping it in a div with style attributes that define the smaller size and the right overflow property. As long as that div has a known size, it should be easy to convert back to an Element.