Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get window dailog changed height using onResize() #1590

Closed
raghunath004 opened this issue Jul 21, 2020 · 12 comments
Closed

how to get window dailog changed height using onResize() #1590

raghunath004 opened this issue Jul 21, 2020 · 12 comments

Comments

@raghunath004
Copy link

Describe the bug
how to get window dailog changed height using onResize()

@olton
Copy link
Owner

olton commented Jul 24, 2020

Please clarify your question. Which component are you interested in window or dialog?

@raghunath004
Copy link
Author

Please clarify your question. Which component are you interested in window or dialog?

Window sir

@raghunath004
Copy link
Author

i want to create window with header footer and canvas sir. while resize the window height i want only resize the canvas sir.
is it any possible to set maximum height of window sir?

Repository owner deleted a comment from raghunath004 Jul 25, 2020
@olton
Copy link
Owner

olton commented Jul 25, 2020

<div data-role="window" data-on-resize="onResize">
    This is a window content
</div>

<script>
    function onResize(size) {
        console.log(size); // size is a object with width and height values
    }
</script>

@olton olton closed this as completed Jul 25, 2020
@raghunath004
Copy link
Author

thank you sir.
can i set max height to window sir because it is resizing outside drag area also

@olton
Copy link
Owner

olton commented Jul 25, 2020

can i set max height to window sir because it is resizing outside drag area also
You must change attribute data-height (int value)

@olton olton reopened this Jul 25, 2020
olton added a commit that referenced this issue Jul 25, 2020
@olton olton added this to the 4.4.0 milestone Jul 25, 2020
olton added a commit that referenced this issue Jul 25, 2020
@olton
Copy link
Owner

olton commented Jul 25, 2020

new in 4.4.0

@blueandblue
Copy link

blueandblue commented Aug 5, 2020

Hi Olton,
it is possible to know the position, size, id of a window (x, y or top, left) to save the state in a database.
When the window reopens, put it back in the position chosen by the user.
Thank you

@olton
Copy link
Owner

olton commented Aug 5, 2020

For predefined window

var pos = Metro.getPlugin("#win1", "window").win.pos();
console.log(pos);

or for Metro.window.create

var win = Metro.window.create({...});
var pos = Metro.getPlugin(win, "window").win.pos();
console.log(pos);

@blueandblue
Copy link

in your example "Desktop" there is the function:


function createWindow(){
// var index = Metro.utils.random(0, 3); // NOT WORK
var index = 123;
var w = Desktop.createWindow({
resizeable: true,
id: "finestra",
draggable: true,
width: 300,
top: 30,
icon: "",
title: w_titles[index],
content: "

This is desktop demo created with Metro 4 Components Library
"
});

setTimeout(function(){
    w.setContent("New window content");
}, 3000);

}


how can i know and save the position (x, y) and window size?
Thank you

@olton
Copy link
Owner

olton commented Aug 5, 2020

// var index = Metro.utils.random(0, 3); // NOT WORK
need change to (already fixed in ...don't remember when)

var index = $.random(0, 3); // or m4q.random(...) if jQuery is used

For position - store returned value from Desktop.createWindow(...) to global variable - this is a HTMLElement as m4q object with role window, and use it in

var pos = Metro.getPlugin(your_global_war, "window").win.pos();
console.log(pos);

@blueandblue
Copy link

blueandblue commented Aug 6, 2020

good morning, thanks for the answers.
Could you help me by giving me a small example.
Thank you

@olton olton closed this as completed Sep 28, 2020
olton added a commit that referenced this issue Oct 28, 2023
olton added a commit that referenced this issue Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants