tool for resizable windows posted
[1/9] from: agem:crosswinds at: 30-May-2001 15:42
http://www.reboltech.com/library/scripts/resize-window.r
Volker
[2/9] from: petr:krenzelok:trz:cz at: 30-May-2001 18:41
----- Original Message -----
From: "Volker Nitsch" <[agem--crosswinds--net]>
To: <[Rebol-list--rebol--com]>
Sent: Wednesday, May 30, 2001 5:42 PM
Subject: [REBOL] tool for resizable windows posted
> http://www.reboltech.com/library/scripts/resize-window.r
Volker - it is nice, however I dare to comment :-)
- scrollbar should appear automatically once stuff doesn't fit the screen.
Or there should be settable option for automatic/manual appearance of
scrollbars. The best behavior of scrollbars so far is imo in SWIS windowing
system ...
- you can't lower window size upon your will - there is some strange limit
(is it settable?) ...
Cheers,
-pekr-
[3/9] from: agem:crosswinds at: 30-May-2001 20:02
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 30.05.01, 17:41:40, schrieb "Petr Krenzelok"
<[petr--krenzelok--trz--cz]>
zum Thema [REBOL] Re: tool for resizable windows posted:
> ----- Original Message -----
> From: "Volker Nitsch" <[agem--crosswinds--net]>
<<quoted lines omitted: 4>>
> > http://www.reboltech.com/library/scripts/resize-window.r
> Volker - it is nice, however I dare to comment :-)
allways worthwhile reading you ;-)
> - scrollbar should appear automatically once stuff doesn't fit the
screen.
> Or there should be settable option for automatic/manual appearance of
> scrollbars. The best behavior of scrollbars so far is imo in SWIS
windowing
> system ...
its modular! *proud*
Scrolling is the job of scroll-face / scroll-pane.
'View-resizable layouts fresh on resize, so they resize automatic.
see rebshet on reb://Volker to test it.
> - you can't lower window size upon your will - there is some strange
limit
> (is it settable?) ...
its set to the initial size of the layout, with
[fresh-layout 0x0].
If you make window smaller, 'size-diff can get negativ,
and face-sizez too then.
One could
i found it funny and smart: if you make the window to small in x or y,
it is set to min-size in that dimension.
So it fits exactly the button-menu making window to small. :)
plug it in an old script, and you get the original intended size,
looking best.
These lines are related:
min-size: current-layout/size
...
new-size: max min-size window-layout/size
current-layout-box/pane: fresh-layout1 new-size - min-size
Another way could be to make window smaller, but keep minimum 0x0,
like
new-size: window-layout/size
current-layout-box/pane: fresh-layout1 new-size - max 0x0 min-size
would hide core-layout then..
need and good name for option?
[4/9] from: ronald:gruss:libertysurf at: 30-May-2001 23:07
Hi Volker,
Don't know the purpose of your script ??
Why don't you use
REBOL[]
faces: layout [
button "quit" [Boo!...]]
faces/options: [resize]
faces/color: water
view/offset faces 200x100
Answer of a Newbie trying to understand...
Bye
[5/9] from: agem:crosswinds at: 31-May-2001 0:05
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 30.05.01, 22:07:47, schrieb "Ronald Gruss"
<[ronald--gruss--libertysurf--fr]> zum Thema [REBOL] Re: tool for resizable
windows posted:
> Hi Volker,
> Don't know the purpose of your script ??
<<quoted lines omitted: 6>>
> view/offset faces 200x100
> Answer of a Newbie trying to understand...
'cause of
faces: layout [
button "quit" [Boo!...]
area 320x240
]
the area keeps it's size when you change window size. I want it to
take the new space.
Like with rebols editor.
So i examined rebols editor a bit and made a function of its
resize-event-catcher.
Looking at the resize-calculations, i thought maybe it could be more
general.
based around
func [SIZE-DIFF] [
layout [
across
t1: area SIZE-DIFF + 320x240 para [] my-text
s1: slider SIZE-DIFF * 0x1 + 16x240 [scroll-para t1 s1]
]
]
base-size is calculatet with size-diff set to 0x0,
the function is recalculated on every resize-event,
with size-diff being the difference to the original size.
So if you extend window with 50x100,
area will grow to 50x100 + 320x240 , slider to 0x100 + 16x240 .
Now i discovered a problem:
how to copy data from the old layout to the new best?
In this example it works, because t1 does its editing in 'my-text,
but if you do [t1/text: »some text«]] and resize, that change would be
lost.
[insert clear t1/text »some text«] should work. but is uncommon?
I am thinking about some support for copying facets from old to new
layout,
but not sure about the best way. How? Is it needed? Opinions?
-Volker
[6/9] from: ronald:infonie at: 31-May-2001 2:27
Ok, sorry for the question ;-))
I'll not be able to help, for now ! but I hope later, ;-))
Thanks to all of you, REBOLERS, I learn a lot whith you.
Bye
[7/9] from: brett:codeconscious at: 31-May-2001 15:32
Hi Volker,
You asked for an opinion :)
> Looking at the resize-calculations, i thought maybe it could be more
> general.
<<quoted lines omitted: 8>>
> base-size is calculatet with size-diff set to 0x0,
> the function is recalculated on every resize-event,
I think calling layout so many times is expensive. It will create so many
faces that look like each other :)
The problem is if the layout is complex it may become slow.
Also, I'm not sure if this way of writing code is more effective than just
coding the resize event directly.
> Now i discovered a problem:
> how to copy data from the old layout to the new best?
I think that you should not try to copy the old layout. It seems to me that
for a resuable resize tool you can go two ways:
1) By manipulating the faces that have already been created
or
2) Creating a new layout, as you have done - with the acknowledgement that
whoever uses the tool must take into
account the way it works. So if they change some text - they have to fix the
layout specification that the resize tool uses.
My preference is to create a way of working that does (1) because it will be
more efficient and if has the possibility that it may work with view
programs that have not be created with VID.
Regards,
Brett.
[8/9] from: agem::crosswinds::net at: 31-May-2001 22:57
Thanks Brett!
I 'm posting a better version immediate.
The base-function gets now
[diff-to-orig-size diff-to-last-size last-used-face]
there are examples for face-recycling
and copy-data-from-old-face for that.
Found nice trick to make a layout with locals:
context[
system/words/lay: layout [t1: area]
lay/data: self
]
now lay/data/t1 is unique for every layout :)
-Volker
>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 31.05.01, 06:32:29, schrieb "Brett Handley" <[brett--codeconscious--com]>
zum Thema [REBOL] Re: tool for resizable windows posted:
[9/9] from: brett:codeconscious at: 1-Jun-2001 14:27
Hi Volker,
> Found nice trick to make a layout with locals:
> context[
> system/words/lay: layout [t1: area]
> lay/data: self
> ]
> now lay/data/t1 is unique for every layout :)
This should be it think:
o: context[
t1: none ; <--- Need this
system/words/lay: layout [t1: area]
lay/data: self
]
I seem to recall a post some time ago warning about changing the 'data field
of a face. Perhaps something about it being a reserved use of VID. But I
can't remember exactly :-/
For interest you could also do something convoluted like this (because
layout returns a face which is a type of object!):
sc: context [
lo: make layout [
t1: button "print data" [print
face/parent-face/special-context/context-data]
] [ special-context: none]
context-data: "Testing"
]
sc/lo/special-context: sc
view sc/lo
Regards,
Brett
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted