Codename One Popup Dialog reduce Padding - dialog

I have an Android App that uses several popup dialogs.
I could figure out quite well how to style them, but there is still a big padding that looks odd on the screen.
Especially the top padding is huge. Seems to me that this the space for the title area.
I have tried to remove it with d.getTitleComponent().remove(), but to no avail.
How can I reduce the padding?
This is my code:
Button buttonDialog = new Button("Okay");
Dialog d = new Dialog();
TextArea popupBody = new TextArea("text.... !", 4, 10);
popupBody.setUIID("PopupBody");
popupBody.setEditable(false);
d.setLayout(new BorderLayout());
d.setDialogUIID("Popup");
d.setDisposeWhenPointerOutOfBounds(true);
d.add(BorderLayout.CENTER, popupBody);
d.add(BorderLayout.SOUTH,label);
d.add(BorderLayout.NORTH,buttonDialog);
d.showPopupDialog(buttonAgain);
CSS is like this:
Popup {
background-color: white;
border-radius: 5pt;
padding: 0pt;
}
PopupBody {
border: 2pt solid red;
border-radius: 5pt;
color: white;
font-size: 8pt;
padding: 35pt;
}

Related

How to increase the size (thickness) of a vaadin progressbar

How am i able to increase the height(thickness) of a vaadin progressbar- 7.6.3. And also how can i display the values which are progressed. For example in the middle of a progressbar showing how much is done and how much is remaining. I have tried with the following code but it is always the default size.
_progress.setWidth("100%");
_progress.setHeight("100%");
and also i tired using css, something like,
_progress.setCaption(" ");
_progress.setCaptionAsHtml(true);
_progress.addstylename("progress");
where ".progress" i have defined in my .css with
.progress1 {
color: black;
text-align: right;
font-size: 2em;
font-weight: bold;
height: 100%;
}
Instead of defining a style just for your progress bar, you have to include the wrapper to your style rule.
.v-progressbar-fat .v-progressbar-wrapper {
height: 20px;
}
If you add this to your style sheet and apply the style name "fat" to your progress bar, it's height will be changed to 20px (Or whatever amount you wish)

css hover creating border but pushing content

Situation
I'm currently building a site and desire to have some elements create a border/outline upon hovering the mouse over them. This is simple enough to make work. For reference, please see the staging site at Stagin area link. I'm using the grid part of the latest bootstrap and the box-sizing model.
Issue
I find that upon hovering, the content below that which is being hovered gets "pushed" far down below the next element. Using the stagin area as reference, I can change the behaviour through CSS to fix this on the left hand side or the right hand side but, not both at the same time.
Code
Here is a snippet of the CSS I use to make the effect:
.hover-border:hover {
border: 3px solid #3A3A3A;
display: block;
}
Using this method, anything but the first element behaves as expected. If I try this next snippet, the first element works but, then the others break:
.hover-border:hover {
border: 3px solid #3A3A3A;
display: block;
margin-top: -6px;
}
For the sake of clarification with regard to properties inherited, I have set the margin/padding on the elements in question to '0 !important' for standard behaviour until hover
Problem
How can I stop the element below from being pushed?
Personally - I go with something along the lines of:
.hover-border {
border: 3px solid transparent;
display: block;
}
.hover-border:hover {
border: 3px solid #3A3A3A;
}
The best solution to these issues is to use the box-sizing:border box property
* {box-sizing:border-box;}
Then elements will retain whatever size you define but it will now INCLUDE borders and padding.
Another solution with less code:
.hover-border:hover{
box-shadow: inset 0 0 0 3px #3a3a3a;
}
Try This will work.
.hover-border {
border: 3px solid transparent;
display: block;
}
.hover-border:hover{
border: 3px solid #3a3a3a;
}
Or
a.no-decoration, a.no-decoration img {
border: medium none;
color: inherit;
cursor: pointer;
outline: medium none;
text-decoration: none;
display: block; /*Added*/
border: 3px solid transparent; /*Added*/
}
Borders are tough to work with when sizing is important. I found it much better to use box-shadow, which just alters the background, so takes up no size.
https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow?v=a
This will work:
.hover-border:hover {
outline: solid 4px #78CF82;
}
"Because the outline property is not a part of the element's dimensions; the element's total width and height is not affected by the width of the outline."

Inline-block not vertically aligning div-elements correctly

I've got a problem with Chrome.
I'm trying to vertically-align some divelements using display: inline-block;
instead of floating them. The problem occurs when I put some text into them: for a strange reason, Chrome displays differently filled divs onto different lines.
Firefox and IE are working correctly.
For better understanding check this example
How can I avoid this?
You need to add for global wrapper font-size: 0; and set regular font size for your inline blocks, you can also add: letter-spacing: 0; and word-spacing: 0;, something like this:
.wrapper {
font-size: 0;
letter-spacing: 0;
word-spacing: 0;
}
.wrapper .inline_block {
display: inline-block;
font-size: 12px;
letter-spacing: 1px;
word-spacing: .1em;
vertical-align: top;
}
and example fiddle: http://jsfiddle.net/3ab22/
and updated fiddle: http://jsfiddle.net/3ab22/3/

ckeditor 3 different body style for full page preview

Is it possible to change body style when entering a full page preview in ckeditor 3. Maybe to set a different body style for full page than when it is not in a full page mode.
The reason for this is using ckeditor when viewing a web page on a larger screen with maximized browser... in that case it is very wide and it is hard to read the content. So I would like to add in body style (but only for full page mode) something like:
...
margin: 5%;
padding: 5%;
border: 1px dotted #666;
...
... that will give more text processor look to the content.
TNX!
When CKEditor is toggled to fullscreen mode it adds "cke_maximized" class to container span.
So you may apply styles for entire container span (body+toolbar) like:
.cke_maximized{
margin: 5%;
padding: 5%;
border: 1px dotted #666;
}
or just for content body:
.cke_maximized iframe{
margin: 5%;
padding: 5%;
border: 1px dotted #666;
}
Those are just examples and you may experiment and choose css selector that is more suitable for you .
UPDATE 1:
Sure, you can use javascript code if it is not enough for your purposes. You can use something like this:
var editor = CKEDITOR.instances.editor1;
editor.on("afterCommandExec", function(e){
if(e.data.name == 'maximize'){
// maximized
if(e.data.command.state == CKEDITOR.TRISTATE_ON){
// add special css class to body(e.editor.document.getBody())
} else {
// minimized
// remove special css from body
}
}
});

How to achieve a hover effect for an image button?

How can I get an image button with hover effect? I have two button images one is simple and the other one is for the hover?
You can easily do it in CSS.
input[type='button']:hover
{
color: #00a;
//or background-image: url("url");
}
You can do it easily with css by using a sprite image and moving the background image depending if its hovered or not.
css:
a { display:block; width: 80px; height: 40px; background: url(bgImage.png) top;
a:hover { background: url(bgImage.png) bottom; }
You have to combine your "simple" and "hover" image into a single image for this to work.

Resources