replaceWith() method's sizeToScene property cuts top and increases bottom part of the window
I have 2 views: LoginScreen and MainScreen. I use replaceWith() to switch to the MainScreen. They both have the same prefHeight and prefWidth. The problem is that when I go from LoginScreen to MainScreen, the bottom part of the window snaps and gets bigger for like 30-40px.
This was my code:
loginScreen.replaceWith(mainScreen, sizeToScene = true, transition=metroAnimation)
and then I tried it with sizeToScene=false and it worked, no more snapping... however I noticed another problem, around 30-40px of MainScreen's top was gone:
sizeToScene=true with growing bottom:

sizeToScene=false, bottom doesn't grow but top part is eaten:

How can I fix it, is there something that I am doing wrong?
This is my MainScreen:
class MainScreen : View("MainScreen") {
private val toolbarLayout: ToolbarLayout by inject()
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = flowpane {
vgap = 20.0
hgap = 20.0
paddingAll = 20
for (i in 0..14) {
add(MobileAppGridItemLayout(i))
}
}
}
}
This is my ToolbarLayout
class ToolbarLayout : View() {
override val root = borderpane {
addClass(PanelStyle.toolbar)
paddingAll = 20
left {
hbox(20) {
label("MainView") {
addClass(PanelStyle.titleText)
textFill = Color.WHITE
}
}
}
right {
vbox {
button("Logout") {
addClass(toolbarButton)
}
}
}
}}
This is a style for default screen height and width used in both LoginScreen and MainScreen:
screen {
prefHeight = 720.px
prefWidth = 1280.px
}
Edited:
I tried replaceWith() without animation and here are the results:
- When
sizeToScene=false, no growing bottoms and no eaten tops. - When
sizeToScene=true, bottom grows.
tornadofx
add a comment |
I have 2 views: LoginScreen and MainScreen. I use replaceWith() to switch to the MainScreen. They both have the same prefHeight and prefWidth. The problem is that when I go from LoginScreen to MainScreen, the bottom part of the window snaps and gets bigger for like 30-40px.
This was my code:
loginScreen.replaceWith(mainScreen, sizeToScene = true, transition=metroAnimation)
and then I tried it with sizeToScene=false and it worked, no more snapping... however I noticed another problem, around 30-40px of MainScreen's top was gone:
sizeToScene=true with growing bottom:

sizeToScene=false, bottom doesn't grow but top part is eaten:

How can I fix it, is there something that I am doing wrong?
This is my MainScreen:
class MainScreen : View("MainScreen") {
private val toolbarLayout: ToolbarLayout by inject()
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = flowpane {
vgap = 20.0
hgap = 20.0
paddingAll = 20
for (i in 0..14) {
add(MobileAppGridItemLayout(i))
}
}
}
}
This is my ToolbarLayout
class ToolbarLayout : View() {
override val root = borderpane {
addClass(PanelStyle.toolbar)
paddingAll = 20
left {
hbox(20) {
label("MainView") {
addClass(PanelStyle.titleText)
textFill = Color.WHITE
}
}
}
right {
vbox {
button("Logout") {
addClass(toolbarButton)
}
}
}
}}
This is a style for default screen height and width used in both LoginScreen and MainScreen:
screen {
prefHeight = 720.px
prefWidth = 1280.px
}
Edited:
I tried replaceWith() without animation and here are the results:
- When
sizeToScene=false, no growing bottoms and no eaten tops. - When
sizeToScene=true, bottom grows.
tornadofx
add a comment |
I have 2 views: LoginScreen and MainScreen. I use replaceWith() to switch to the MainScreen. They both have the same prefHeight and prefWidth. The problem is that when I go from LoginScreen to MainScreen, the bottom part of the window snaps and gets bigger for like 30-40px.
This was my code:
loginScreen.replaceWith(mainScreen, sizeToScene = true, transition=metroAnimation)
and then I tried it with sizeToScene=false and it worked, no more snapping... however I noticed another problem, around 30-40px of MainScreen's top was gone:
sizeToScene=true with growing bottom:

sizeToScene=false, bottom doesn't grow but top part is eaten:

How can I fix it, is there something that I am doing wrong?
This is my MainScreen:
class MainScreen : View("MainScreen") {
private val toolbarLayout: ToolbarLayout by inject()
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = flowpane {
vgap = 20.0
hgap = 20.0
paddingAll = 20
for (i in 0..14) {
add(MobileAppGridItemLayout(i))
}
}
}
}
This is my ToolbarLayout
class ToolbarLayout : View() {
override val root = borderpane {
addClass(PanelStyle.toolbar)
paddingAll = 20
left {
hbox(20) {
label("MainView") {
addClass(PanelStyle.titleText)
textFill = Color.WHITE
}
}
}
right {
vbox {
button("Logout") {
addClass(toolbarButton)
}
}
}
}}
This is a style for default screen height and width used in both LoginScreen and MainScreen:
screen {
prefHeight = 720.px
prefWidth = 1280.px
}
Edited:
I tried replaceWith() without animation and here are the results:
- When
sizeToScene=false, no growing bottoms and no eaten tops. - When
sizeToScene=true, bottom grows.
tornadofx
I have 2 views: LoginScreen and MainScreen. I use replaceWith() to switch to the MainScreen. They both have the same prefHeight and prefWidth. The problem is that when I go from LoginScreen to MainScreen, the bottom part of the window snaps and gets bigger for like 30-40px.
This was my code:
loginScreen.replaceWith(mainScreen, sizeToScene = true, transition=metroAnimation)
and then I tried it with sizeToScene=false and it worked, no more snapping... however I noticed another problem, around 30-40px of MainScreen's top was gone:
sizeToScene=true with growing bottom:

sizeToScene=false, bottom doesn't grow but top part is eaten:

How can I fix it, is there something that I am doing wrong?
This is my MainScreen:
class MainScreen : View("MainScreen") {
private val toolbarLayout: ToolbarLayout by inject()
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = flowpane {
vgap = 20.0
hgap = 20.0
paddingAll = 20
for (i in 0..14) {
add(MobileAppGridItemLayout(i))
}
}
}
}
This is my ToolbarLayout
class ToolbarLayout : View() {
override val root = borderpane {
addClass(PanelStyle.toolbar)
paddingAll = 20
left {
hbox(20) {
label("MainView") {
addClass(PanelStyle.titleText)
textFill = Color.WHITE
}
}
}
right {
vbox {
button("Logout") {
addClass(toolbarButton)
}
}
}
}}
This is a style for default screen height and width used in both LoginScreen and MainScreen:
screen {
prefHeight = 720.px
prefWidth = 1280.px
}
Edited:
I tried replaceWith() without animation and here are the results:
- When
sizeToScene=false, no growing bottoms and no eaten tops. - When
sizeToScene=true, bottom grows.
tornadofx
tornadofx
edited Jan 19 at 20:46
Mirmuhsin Sodiqov
asked Jan 19 at 18:17
Mirmuhsin SodiqovMirmuhsin Sodiqov
61211
61211
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I think I found the issue, it was because items of flowpane were more than they could fit into the window. I added flawpane into the scrollpane and the problem was solved.
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = scrollpane {
isFitToHeight = true
isFitToWidth = true
vbarPolicy = ScrollPane.ScrollBarPolicy.AS_NEEDED
content = flowpane {
vgap = 20.0
hgap = 20.0
padding = insets(20, 40, 20, 40)
for (i in 0..15) {
add(MobileAppGridItemLayout(i))
}
}
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54270043%2freplacewith-methods-sizetoscene-property-cuts-top-and-increases-bottom-part-o%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think I found the issue, it was because items of flowpane were more than they could fit into the window. I added flawpane into the scrollpane and the problem was solved.
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = scrollpane {
isFitToHeight = true
isFitToWidth = true
vbarPolicy = ScrollPane.ScrollBarPolicy.AS_NEEDED
content = flowpane {
vgap = 20.0
hgap = 20.0
padding = insets(20, 40, 20, 40)
for (i in 0..15) {
add(MobileAppGridItemLayout(i))
}
}
}
}
add a comment |
I think I found the issue, it was because items of flowpane were more than they could fit into the window. I added flawpane into the scrollpane and the problem was solved.
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = scrollpane {
isFitToHeight = true
isFitToWidth = true
vbarPolicy = ScrollPane.ScrollBarPolicy.AS_NEEDED
content = flowpane {
vgap = 20.0
hgap = 20.0
padding = insets(20, 40, 20, 40)
for (i in 0..15) {
add(MobileAppGridItemLayout(i))
}
}
}
}
add a comment |
I think I found the issue, it was because items of flowpane were more than they could fit into the window. I added flawpane into the scrollpane and the problem was solved.
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = scrollpane {
isFitToHeight = true
isFitToWidth = true
vbarPolicy = ScrollPane.ScrollBarPolicy.AS_NEEDED
content = flowpane {
vgap = 20.0
hgap = 20.0
padding = insets(20, 40, 20, 40)
for (i in 0..15) {
add(MobileAppGridItemLayout(i))
}
}
}
}
I think I found the issue, it was because items of flowpane were more than they could fit into the window. I added flawpane into the scrollpane and the problem was solved.
override val root = borderpane {
addClass(screen)
top = toolbarLayout.root
center = scrollpane {
isFitToHeight = true
isFitToWidth = true
vbarPolicy = ScrollPane.ScrollBarPolicy.AS_NEEDED
content = flowpane {
vgap = 20.0
hgap = 20.0
padding = insets(20, 40, 20, 40)
for (i in 0..15) {
add(MobileAppGridItemLayout(i))
}
}
}
}
answered Jan 20 at 21:07
Mirmuhsin SodiqovMirmuhsin Sodiqov
61211
61211
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54270043%2freplacewith-methods-sizetoscene-property-cuts-top-and-increases-bottom-part-o%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown