About Monkey 2 › Forums › Monkey 2 Programming Help › Vertical Scroll Pyro 2
This topic contains 2 replies, has 2 voices, and was last updated by
APC
1 year, 2 months ago.
-
AuthorPosts
-
January 29, 2018 at 12:13 am #13323
I am trying to develop an app for mobile phones, Android and iOS and I am having trouble to implement a vertical scrolling.
The app has 5 GuiButtons on the main screen, each button displays a new guilayer, and each guilayer has a back button, this part is working fine.
In one of the guilayers I have things to display that does not fit on the screen and I have to use a vertical scroll. I tryed using the camera but it is not compatible with Screen Manager, if I try to use the Window instead the the GuiLayer, GuiLabel and GuiImage are not compatible with Window.
How can I implement a vertical scrolling that is compatible with Pyro 2 gui ?
January 29, 2018 at 4:52 am #13327Off the top of my head, a guilayer X and Y can be used to scroll.
January 31, 2018 at 1:11 pm #13394Playniax,
I was able to do my vertical scrolling with this code.
Monkey1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950Method OnMouseEvent( event:MouseEvent ) Override' Send mouse events to all gui'mouseWheel= event.WheelIf guiPage=GROUPS'Check for mouseIf Mouse.ButtonDown(MouseButton.Left) Or Mouse.ButtonDown(MouseButton.Right) Or Touch.FingerDown( 0 ) Or Touch.FingerDown( 1 )If Mouse.Y>memY 'Check Mouse DirectionDown()memY=Mouse.Y 'save mouse positionElseUp()memY=Mouse.Y 'save mouse positionEndifEndif' Check for TouchIf Touch.FingerDown( 0 ) 'Or Touch.FingerDown( 1 )If Touch.FingerY(0)>memTY 'Check Mouse DirectionDown()memTY=Touch.FingerY(0)ElseUp()memTY=Touch.FingerY(0)EndifEndif'Check for Mouse Wheel' If mouseWheel.Y=-1' Down()' Elseif mouseWheel.Y=1' Up()' EndifEndifguiLayer[guiPage].SendMouseEvent( event )EndMethod Up()mousetxt="UP:"+Mouse.Y+ " memY:"+memY+ " guiPageY:"+guiLayer[guiPage].Y+ " TouchY:"+ Touch.FingerY(0) + " memTY:" + memTY+" mouseWheel:"+mouseWheel.YPrint mousetxtguiLayer[guiPage].Y-=10'limit the bottom of the guiPage to the window height.If guiLayer[guiPage].Y <=-WINDOW_HEIGHT Then guiLayer[guiPage].Y=-WINDOW_HEIGHTEndMethod Down()mousetxt="Down:"+Mouse.Y+ " memY:"+memY+ " guiPageY:"+guiLayer[guiPage].Y+" TouchY:"+ Touch.FingerY(0) + " memTY:" + memTY+" mouseWheel:"+mouseWheel.YPrint mousetxtguiLayer[guiPage].Y+=10'limit the top guiPage to the top of the windowIf guiLayer[guiPage].Y>=0 Then guiLayer[guiPage].Y=0memY=Mouse.Y 'save mouse positionEnd -
AuthorPosts
You must be logged in to reply to this topic.