changing screen size using corners of the run window
Author |
Message |
Siavash
|
Posted: Mon May 25, 2009 9:38 pm Post subject: changing screen size using corners of the run window |
|
|
ive seen many tutorials on how to change screen size like the fallowing:
But how do i allow the user make the screen larger by dragging the corners of the run window? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DtY
![](http://compsci.ca/v3/uploads/user_avatars/8576159234be48b7a8b0e8.png)
|
Posted: Mon May 25, 2009 9:57 pm Post subject: RE:changing screen size using corners of the run window |
|
|
As far as I know, you can't |
|
|
|
|
![](images/spacer.gif) |
Dusk Eagle
![](http://compsci.ca/v3/uploads/user_avatars/78727197549dd7290a342c.png)
|
Posted: Mon May 25, 2009 11:30 pm Post subject: Re: changing screen size using corners of the run window |
|
|
You can't do what you wanted, but you can set the screen size using variables, like this:
So, since this is entirely possible, you could add buttons to your screen that increase or decrease the screen's size. Not sure if this can help you here, but it's an interesting thing to know either way, |
|
|
|
|
![](images/spacer.gif) |
Kharybdis
![](http://compsci.ca/v3/uploads/user_avatars/111642592477ec7e78e574.gif)
|
Posted: Tue May 26, 2009 7:57 am Post subject: RE:changing screen size using corners of the run window |
|
|
you can kinda cheat and make this possible... like you can do with anything..
but i wouldn't recommend it. too much work.. |
|
|
|
|
![](images/spacer.gif) |
BigBear
|
Posted: Tue May 26, 2009 9:34 am Post subject: Re: RE:changing screen size using corners of the run window |
|
|
Kharybdis @ Tue May 26, 2009 7:57 am wrote: you can kinda cheat and make this possible... like you can do with anything..
but i wouldn't recommend it. too much work..
How is it cheating, you can't drag the corners with the mouse but you can figure out a way of using turing, isn't that what programming is learning how to use a programming language? |
|
|
|
|
![](images/spacer.gif) |
Geniis
![](http://compsci.ca/v3/uploads/user_avatars/5256207144abc3197db7ab.jpg)
|
Posted: Wed May 27, 2009 6:02 pm Post subject: Re: changing screen size using corners of the run window |
|
|
i made a quick prog to resize the window once. All i did was check if the mouse was on a border or corner then then figured out the difference and set the screens size with setscreen to the old size plus the difference. But whenever i did the window would disappear and reapear so its not worth dooing. |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Wed May 27, 2009 9:10 pm Post subject: RE:changing screen size using corners of the run window |
|
|
This code demonstrates how this can be done, but as Geniis notes, it destroys and re-creates the window every time you resize it, and it doesn't resize with the cursor (you could also do that, but I didn't). It's also not perfect - if you click your mouse anywhere and drag over that corner, it'll grab it anyway (this is fixable, but I'm lazy).
Turing: |
var x, y : int := 400 % Size of the screen
var mx, my, mb : int % Mouse status
var dragging : boolean := false % True if and only if we're dragging the window corner
const TOLERANCE : int := 5 % Tolerance for mouse-click distance, in pixels
fcn nearEquals (a, b, tol : int) : boolean % Comparator that's essentially "approximately equal to, plus or minus 'tol'".
result a + tol >= b and a - tol <= b
end nearEquals
View.Set ("graphics:" + intstr (x ) + ";" + intstr (y ))
loop
% Grab input information
Mouse.Where (mx, my, mb )
if mb > 0 and nearEquals (x, mx, TOLERANCE ) and nearEquals (0, my, TOLERANCE ) then % We're clicking near that corner, start dragging
dragging := true
elsif mb = 0 and dragging then % Released, so resize
dragging := false
x := mx
y := maxy-my
View.Set ("graphics:" + intstr (x ) + ";" + intstr (y ))
end if
% Debugging output
Text.Locate (1, 1)
put "x = ", x, "; y = ", y
put "mx = ", mx, "; my = ", my
put "dragging = ", dragging
end loop
|
|
|
|
|
|
![](images/spacer.gif) |
|
|