B4J Question ScrollViewInnerPanel: cross-platform editor container - how ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

If to create an editor of big area (like CAD-software), bigger than the app form\activity - it needs some 2D-scrolling container. But the editor should allow objects moving inside the container that is scrollable itself.

1) How to use cross-platform B4XView as 2D ScrollView with dynamic manual object manipulations, dragging ?
ScrollViewInnerPanel is always non-initialized, and read-only. How to use ?

2) Zooming in\out of the editor by the mouse scrolling wheel - any solution together here ?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
2) Seems, solution for this point is found for B4J.
But scaling the all by the scaling one editor panel does not help to enlarge the editor area :(

B4X:
'Editor - is a B4XView panel container.

....
   setHandler(Editor,"setOnScroll","scroll")
End Sub

Sub setHandler(ob As JavaObject,eventName As String,handlerName As String)
    ob.RunMethod(eventName, Array(ob.CreateEventFromUI("javafx.event.EventHandler",handlerName,True)))
End Sub

Sub scroll_Event(MethodName As String, Args() As Object)
    Dim jo As JavaObject
    jo.InitializeStatic("javafx.scene.input.ScrollEvent")
    jo = Args(0)
    If jo.RunMethod("getDeltaY",Null) > 0 And scale <= 3  Then 'zoom in up to 3 times
        scale = scale + 0.05
    End If
    If jo.RunMethod("getDeltaY",Null) < 0 And scale >= 0.2  Then  'zoom out up to 0.2 time
        scale = scale - 0.05
    End If
    asJO(Editor).RunMethod("setScaleX",Array(scale))
    asJO(Editor).RunMethod("setScaleY",Array(scale))
    asJO(Editor).RunMethod("requestLayout",Null)
End Sub
Sub asJO(o As JavaObject) As JavaObject
    Return o
End Sub
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Seems, i could make something with help of SD XUIScrollView2D !
But strange that if
B4X:
Private Editor As XUIScrollView 'zoom works wrong, but all is visible, including text labels
or
Private Editor As xScrollView 'zoom works OK ! but why labels are ... not visible

HI, All - If you can help - try to check "b4xVectEdit_v0.21_xScrollView.zip" why not visible Labels
 

Attachments

  • TempDownload.png
    TempDownload.png
    17.7 KB · Views: 17
  • TempDownload.png
    TempDownload.png
    19.4 KB · Views: 17
  • b4xVectEdit_v0.21_xScrollView.zip
    8.6 KB · Views: 20
  • b4xVectEdit_v0.21_XUIScrollView.zip
    8.6 KB · Views: 15
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
I'm sorry, I would like to help you but I don't understand what you mean
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I'm sorry, I would like to help you but I don't understand what you mean

See 2 screenshots: Labels (B4XViews) are not visible if to use xScrollView. Also, pls, see in private conversation.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
See 2 screenshots: Labels (B4XViews) are not visible if to use xScrollView. Also, pls, see in private conversation.
Don't write to me privately, I don't provide assistance privately.

From the image it is not clear to me what you need. If you can explain better maybe I can help you
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
Top