Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a Panel of size {850, 400} as myPanel with a Pane of size {450, 400} and four images assigned to forwardPicture, backwardPicture, picture1 and picture2.

forwardPicture=

enter image description here

backwardPicture=

enter image description here

picture1=

enter image description here

picture2=

enter image description here

Both picture1 and picture2 are of size {400, 400},

myPanel = Panel[Row[{picture1, picture2}], ImageSize -> {850, 400}];

Row[{
  MouseAppearance[EventHandler[
    Framed[backwardPicture, 
     FrameStyle -> None], {"MouseClicked" :> ""}], "LinkHand"],
  Pane[myPanel, ImageSize -> {450, 400}, Scrollbars -> None], 
  MouseAppearance[EventHandler[
    Framed[forwardPicture, 
     FrameStyle -> None], {"MouseClicked" :> ""}], "LinkHand"]
  }]

After evaluation, I get this:

enter image description here

I want to move the images from right to left within the Pane whenever forwardPicture is pressed, and move them from left to right whenever backwardPicture is pressed. I don't want any scrollbars in the Pane. I don't want to move the images at one click: I want to move them a little bit for every click, until the full image is displayed. Can anybody help me?

share|improve this question
    
István Zachar,we have to solve this problem very easily,If we have to fix the dimensions to the panel. why because,at the starting time Panel displayed with some certain dimensions(min:0,max:50),and then next dimensions increased like (min:10,max=60) whenever forwardPicture is pressed...I think like that ,so I mentioned "dimension". –  subbu Nov 7 '12 at 20:32
    
Ok, in the meantime I've figured it out :) –  István Zachar Nov 7 '12 at 20:46
add comment

2 Answers

up vote 3 down vote accepted

You can still use the ScrollPosition option in Pane, even though there are no scroll bars. Set this to a Dynamic value and make the "MouseClicked" action increase or decrease that value.

e.g.

DynamicModule[{s},
  Row[{
  MouseAppearance[EventHandler[Framed[backwardPicture, FrameStyle -> None],
    {"MouseClicked" :> (s -= 10)}], "LinkHand"], 
  Pane[myPanel, ImageSize -> {450, 400}, Scrollbars -> None, ScrollPosition -> Dynamic[{s, 0}]], 
  MouseAppearance[EventHandler[Framed[forwardPicture, FrameStyle -> None],
    {"MouseClicked" :> (s += 10)}], "LinkHand"]}]]
share|improve this answer
    
Simon Woods, Thanks for your reply...but moving Appearancewas bad..so How can I change that? –  subbu Nov 7 '12 at 20:52
    
@subbu, I'm not sure what you mean. Can you explain in more detail? –  Simon Woods Nov 7 '12 at 21:20
    
ImageSizeAction -> "Scrollable" might be an alternative -- in which case the forward and back arrows are probably redundant. –  Mike Honeychurch Nov 7 '12 at 21:23
    
@Simon Woods,we have to see this type of application,whenever we have to open new tab in google chrome, in that moving Appearance was so good,whenever we have to press on forwardButton and Backwardbutton...can we provide Appearance like that? –  subbu Nov 8 '12 at 20:10
    
@subbu, I don't use google chrome. Can you describe what makes the appearance good? –  Simon Woods Nov 8 '12 at 21:09
add comment

I've used ImageAssemble to replace Row in myPanel, as Row is subject to linebreaks. The left/right step buttons use a +/-20 unit stepsize, this can be customized for the user's taste.

DynamicModule[{myPanel, max, d = 0},
 myPanel = 
  ImageAssemble@{ImageResize[picture1, {Automatic, 400}], 
    ImageResize[picture2, {Automatic, 400}]};
 max = First@ImageDimensions@myPanel;
 Panel@Row[{
    MouseAppearance[EventHandler[Framed[backwardPicture, 
       FrameStyle -> None], {"MouseClicked" :> (d = Min[d + 20, max - 450])}], 
     "LinkHand"],
    Pane[Show[myPanel, ImageSize -> {Automatic, 400}], 
     Scrollbars -> False, ImageSize -> {450, 400}, 
     ScrollPosition -> Dynamic@{d, 0}],
    MouseAppearance[EventHandler[
      Framed[forwardPicture, FrameStyle -> None], {"MouseClicked" :> (d = Max[0, d - 20])}],
      "LinkHand"]
    }]
 ]

Mathematica graphics

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.