R3-GUI: sizes and offset

Started by Jean-Louis on 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 ?
as written this can't work since you haven't referenced img2, and you're saving the wrong offset.
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 ]
Your Logic is still wrong. once you correct that you could try using show-now which can sometimes help
I do not understand...
Try changing sav: g1/gob/offset to sav: g2/gob/offset
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 - ]
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.
;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 ]-
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