I am new to webix and have a problem with ui.window!
For me the window never adjusts to the parent HTML element. :(
I want the window to have the same width and height as the parent (100%).
What am I dowing wrong?
See code in Webix Snippets: http://webix.com/snippet/c5fe5e96
According to the documentation:
"Window Sizing and Positioning
The must-have parameters for the window are width and height. If you don't set [them], the window [...] will occupy the whole screen."
http://docs.webix.com/desktop__window.html
"adjust - adjusts the component to the size of the parent html container"
http://docs.webix.com/api__link__ui.popup_adjust.html
Window and Popup widgets are working for the whole app, they are not using container and can't use .adjust as well.
You can size the Window to the document by using fullscreen option
var popup = webix.ui({
view: "window",
fullscreen:true,
http://webix.com/snippet/93a5e3ba
or by using the complex position property
var popup = webix.ui({
view: "window",
position:function(state){
state.left = state.top = 10;
state.width = state.maxWidth - 20;
state.height = state.maxHeight-20;
},
http://webix.com/snippet/164a3955
I have managed to make the window inherit the size of the HTML container by getting the HTML container size by using getNode() and then using setPosition, config.width, config.height and resize().
See example below.
http://webix.com/snippet/056b9610
Related
How could I scroll one page to the right in Cypress?
E.g. I have a horizontally scrollable area. The area contains elements a, b and if I scroll to the right a and b get destroyed, while c and d get added.
My attempt is to find out the width of the scrollable view and then scroll that amount to the right. But the width does not get retrieved before the scrollTo gets called.
Here is what I am trying to do:
const width = cy.getCy("scroll-viewport").invoke("width");
cy.getCy("scroll-viewport").scrollTo(width, 0);
Your code sample has some mystery about it, for example what is cy.getCy().
I can show you how to do it with standard code, and you can adapt from there.
Assuming scroll-viewport is a selector for the scroll container (the owner of the scroll bar)
cy.get("scroll-viewport").then($scrollContainer => {
const width = $scrollContainer[0].offsetWidth;
$scrollContainer[0].scrollTo(width, 0);
})
Note $scrollContainer[0].scrollWidth gives you the total width after scrolling, in case you need that.
Hello I'm developing a Xamarin.Forms application.
I have this code and the image fits to page on simulator.
How can I display the image in its original size?
var image = new Image { Aspect = Aspect.AspectFit};
image.Source = "image2.png";
Content = image;
To set the dimensions of an image you can't use the Width and Height properties. Because the Width and Height properties are read-only (as the error said).
Try to use the WidthRequest and HeightRequest properties to set your desired dimension.
Infos from Xamarin-Developer-Page:
WidthRequest does not immediately change the Bounds of a
VisualElement, however setting the WidthRequest will change the result
of calls to GetSizeRequest, which will in turn modify the final size
the element receives during a layout cycle.
I am using tkinter when and trying to set up a window with a background image. In some of the processes I have a frame that fills up with checkboxes so I created a scrollbar so the user can see all the options. The problem is the scroll bar also moves the background image of the canvas. Is there a way I can fix the image to not move or somehow move the frame by itself.
code is
def canvasScroll():
canvas = gui.createCanvas()
fFrame = gui.createNewFrame()
scrollbar = Scrollbar(root, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand = scrollbar.set)
scrollbar.pack(side="right", fill="y")
canvas.pack(side="left", fill="both", expand= True)
canvas.create_window((150,50),window = fFrame, anchor='nw', tags = "frame")
gOb.change_canvas(canvas)
fFrame.bind("<Configure>", gui.scroll)
gOb.change_scrollbar(scrollbar)
gOb.change_frame(fFrame)
def createCanvas():
canvas = Canvas(root,height = _h, width = _w,highlightthickness = 0)
canvas.pack(side='top',fill='both',expand='yes')
canvas.create_image(-200,-200,image=bground,anchor='nw')
return canvas
def createNewFrame():
frame = Frame(root,height = _h, width = _w,background='white')
frame.pack()
return frame
Just to clear things up, these guys are all part of a class name gui and gOb is an object that hold several gui objects.
Here's one idea - it's kind of kludgy, but it would work. Every time the scrollbar scrolls, shift the background image's position so it appears to stay in the same place:
Tag your image so you can access it later:
canvas.create_image(-200,-200,image=bground,anchor='nw',tags="background")
# ^^^^^^^^^^^^^^^^^
Make your scrollbar call a function that you define:
scrollbar = Scrollbar(root, orient="vertical", command=scrollCallback)
Define your scroll callback:
def scrollCallback(*args):
canvas.yview(*args)
# Arrange for your background image to move so it appears to stay in the same position as the canvas scrolls.
I want to use popUp element in windows phone (C#) to view a message on screen
I did the following:
popUpBanner = new Popup();
popUpBanner.HorizontalAlignment = HorizontalAlignment.Center;
popUpBanner.VerticalAlignment = VerticalAlignment.Center;
But the popup element appears in the top left of the screen .. not at the center
How can I solve this
In Windows Phone the Pop up is not a UserControl class. Instead of centering the popup you want to center the ui elements within the popup's child element...
To be more specific, I updated my code and hope it helps you.
First lets get the screen size(i.e. Width & Height)
var width = System.Windows.Application.Current.Host.Content.ActualWidth;
var height = System.Windows.Application.Current.Host.Content.ActualHeight;
Lets create a StackPanel, adding background color to it and re-sizing the StackPanel according to the device screen resolution.
StackPanel stackPanel = new StackPanel();
stackPanel.Background = new SolidColorBrush(Colors.Gray);
stackPanel.Height = height / 4;
stackPanel.Width = width / 2;
Finally Create a Popup and add it as a children to the StackPanel.
Popup Popup1 = new Popup();
stackPanel.Children.Add(Popup1);
ContentPanel.Children.Add(stackPanel);
Popup1.IsOpen = true;
You are done. Modify your StackPanel size according to your need, since you got the screen resolution here.
I wanted to increase the height of my div (id = scroller) and set it at the end of the success call back function. In the success callback function I dynamically inject some inner div's which are contained in the "scroller" div.
Default height of scroller div is 400 px. Dynamically it comes e.g. as 900px, then it should be set as 900px.
height = $('#content').innerHeight();
alert("outside: " + height);
$('#scroller').css('height', height + "px");
So far so good. Now, this resizing works if I have an alert statement. If I remove the alert, it doesnt resize itself.
What might be the problem ?
Thanks in advance.
P.S. height: auto doesnt work maybe because I am expecting this functionality on android emulator/cellphone and i am developing my mobile app using Phonegap.
how about creating a new div, loading your data into it, then using the jQuery replaceWith() method to replace the old content div with the new one. That might be one way to force the browser to recalculate the height of the (new) content div and everything around it.
Something like:
var newContent = $('<div id="content"></div>').load(toLoad,'',showNewContent());
$('#content').replaceWith(newContent);