R3-GUI: sizes and offset
Started by Jean-Louis on 10-Aug-2014/16:55:49-7:00
Jean-Louis — 10-Aug-2014/16:55:49-7:00
R E B O L [title: "test "]
do %r3-gui.r3
img2: load %image2.jpg
img1: load %image1.jpg
view [
-button "start" on-action [
--sav: g1/gob/offset
--g2/gob/offset: g1/gob/offset
--g1/gob/offset: sav
--show g1/gob
--show g2/gob
-]
- g1: --image img1
- g2: --image img
-
]
;--------------------
2 problems:
-1- the init display does not position images at the right position. When I resize the window using the mouse, the display positions the images correctly.
-2- When I click the button to swap img1 and img (in exchanging their offset values), it is not correct. when I resize the window using the mouse, the images are in their initial position (initial offset).
An idea to correct this behaviour ?
Graham — 11-Aug-2014/3:23:10-7:00
as written this can't work since you haven't referenced img2, and you're saving the wrong offset.
JeanLouis — 11-Aug-2014/7:15:01-7:00
I make a mistake to copy the script.
But the 2 problems exist.
-1- initial display does not correctly position the images. Correct position is made if I resize the display with the mouse.
-2- I click the button to exchange offset values of the 2 images. And when I resize the window with the mouse, the images are positoned at their initial offset values.
---------------------------------------------
view [
button "start" on-action [
sav: g1/gob/offset
g2/gob/offset: g1/gob/offset
g1/gob/offset: sav
show g1/gob
show g2/gob
]
g1: image img1
g2: image img2
]
Graham — 12-Aug-2014/1:09:26-7:00
Your Logic is still wrong. once you correct that you could try using show-now which can sometimes help
JeanLouis — 12-Aug-2014/17:02:47-7:00
I do not understand...
Graham — 13-Aug-2014/15:39:45-7:00
Try changing
sav: g1/gob/offset
to
sav: g2/gob/offset
JeanLouis — 13-Aug-2014/18:22:22-7:00
Sorry, I made another mistake but.. the problems are always there...
view [
-button "start" on-action [
----sav: g2/gob/offset
----g2/gob/offset: g1/gob/offset
----g1/gob/offset: sav
----show g1/gob
----show g2/gob
-]
-
- g1: --image img1
- g2: --image img2
-
]
Graham — 16-Aug-2014/3:22-7:00
R E B O L [title: "test "]
do %r3-gui.r3
img2: load http://www.crystalinks.com/loverswater2.jpg
img1: load http://wikieducator.org/images/7/7b/Soulmates1.jpg
view [
-h: hpanel [
--g1: image img1
--g2: image img2
-]
-hpanel [
--button "start" on-action [
---sav: g2/gob/offset
---g2/gob/offset: g1/gob/offset
---g1/gob/offset: sav
---show g2/gob
---show g1/gob
--]
--button "?" on-action [
---print ["G1: " g1/gob/offset "G2: " g2/gob/offset]
--]
-]
]
If you resize and then try it, it works. I haven't done much with images so better to ask Cyphre on Altme why it's not behaving.
yoffset — 16-Aug-2014/12:57:26-7:00
;try this and modify
R E B O L [title: "test "]
do %r3-gui.r3
img2: load http://www.crystalinks.com/loverswater2.jpg
img1: load http://wikieducator.org/images/7/7b/Soulmates1.jpg
view/options [
h: hpanel [
g1: image img1
g2: image img2
]
hpanel [
button "start" on-action [
sav2: g2/gob/offset
------sav1: g1/gob/offset
g2/gob/offset: sav1
g1/gob/offset: sav2
show g2/gob
show g1/gob
]
button "?" on-action [
print ["G1: " g1/gob/offset "G2: " g2/gob/offset]
]
]
] [
init-hint: 1000x900
]-
JeanLouis — 17-Aug-2014/11:12:29-7:00
The best I found :
- same size for images to exchange offset with no problem
- no resize
R E B O L [title: "image overlay"]
do %r3-gui.r3
img2: load http://www.crystalinks.com/loverswater2.jpg
img: load http://wikieducator.org/images/7/7b/Soulmates1.jpg
img1: copy/part at img 0x0 img2/size
view/no-wait/options [
h: hpanel [
g1: image img1
g2: image img2
]
hpanel [
button "start" on-action [
sav2: g2/gob/offset
--- g2/gob/offset: g1/gob/offset
g1/gob/offset: sav2
show g2/gob
show g1/gob
]
button "?" on-action [
print ["G1: " g1/gob/offset "G2: " g2/gob/offset]
]
]
] [
init-hint: as-pair 2 * img2/size/1 img2/size/y + 10
min-hint: 'init
max-hint: 'init
]
g1/facets/resizes: false
g2/facets/resizes: false
do-events
Reply