Hi all,
Is there a B4J object that is like the .NET Statusbar resizer that is in the right most position of the statusbar?
When the user moves the mouse pointer over the object, which are a bunch of dots, the pointer changes to a NW-SE arrow image, which allows the user to then resize the form.
If there is a "work-around" object/view for this, can someone please elaborate?
Yes, it is to resize the form.
It's easier to "grab/drag" something that is in a bigger area than the side frames of the form.
If you are familiar with the Visual Studio IDE, it has a grabber area in the bottom right and on the statusbar.
Without this, I'm having to put the mouse in the exact position on the form frame for resizing. Frustrating for me.
Having the grabber area makes a better user experience.
EDIT: so is it possible to add a resizer object to the Statusbar?
'resize code
Sub imgResize_MouseDragged (EventData As MouseEvent)
Dim jo As JavaObject = EventData
Dim ScreenX As Double = jo.RunMethod("getScreenX", Null)
Dim ScreenY As Double = jo.RunMethod("getScreenY", Null)
MainForm.WindowWidth = ScreenX - MainForm.WindowLeft
MainForm.WindowHeight = ScreenY - MainForm.WindowTop
End Sub
Sub Process_Globals
Private imgResize As ImageView
End Sub
Sub imgResize_MouseDragged (EventData As MouseEvent)
Dim jo As JavaObject = EventData
'wasn't sure where to put the next 2 lines, so put them here
'if not here, where should they be placed?
imgResize.PickOnBounds = True
imgResize.MouseCursor = jo.InitializeStatic("javafx.scene.Cursor").GetField("SE_RESIZE")
Dim ScreenX As Double = jo.RunMethod("getScreenX", Null) ' errors on this line
Dim ScreenY As Double = jo.RunMethod("getScreenY", Null)
frm.WindowWidth = ScreenX - frm.WindowLeft
frm.WindowHeight = ScreenY - frm.WindowTop
End Sub
But get this error when dragging the image:
java.lang.RuntimeException: Method: getScreenX not found in: javafx.scene.Cursor
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
I have the following libraries checked:
JavaObject
jControlsFX
jCore
jFX
jShell
jSQL
I'm not sure I can put them there as the Main Code Module is not the "Main" form.
MenuForm Code Module, is the "Main" form and is called from Login after a successful user login validation.
B4X:
#Region Project Attributes
#MainFormWidth: 1500
#MainFormHeight: 800
#AdditionalJar: jtds-1.3.1.jar
#End Region
Sub Process_Globals
Private fx As JFX
End Sub
Sub AppStart (Form1 As Form, Args() As String)
DBManager.DBConnect
'Login is a Code Module and is called here to allow the user to login to the app
Login.Show
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
I'll have a go at putting the jo JavaObject and code in the MenuForm and see how it goes.
Dim ScreenX As Double = jo.RunMethod("getScreenX", Null) ' errors on this line
Error message:
java.lang.RuntimeException: Method: getScreenX not found in: javafx.scene.Cursor
at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:363)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:120)
Kiffi,
Downloaded your ResizeTest app and it worked perfectly.
The important part about defining how this works, is in where and how the Dim jo objects are declared, which was missing from Erel's #4 explanation, or didn't understand it.